Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

ajax use.

hello,

i've started to use ajax 4 the last time but i feel that the way i'm using it is wrong. right now i have the xmlhttp.asp and i've made a new page called xmlhttpresponse, witch have inside some functions for the xmlhttp.asp,
for example :

set rs = Server.CreateObject("ADODB.recordset")
rs.Open sqlString, conn,3,1

//--------------- ResponseType 1 ---------

if ResponseType = "1" then
response.write("<table>")
do until rs.EOF
for each x in rs.Fields
response.write("<tr><td><b>" & x.name & "</b></td>")
response.write("<td>" & x.value & "</td></tr>")
next
rs.MoveNext
loop
response.write("</table>")

//--------------- ResponseType 2 ---------

elseif ResponseType = "2" then
strAddress = rs("CompanyName") & VBCRLF & rs("Address")
if trim(rs("Region"))<>"" then strAddress = strAddress & VBCRLF & rs("Region")
strAddress = strAddress & VBCRLF & rs("City") & " , " & rs("ZipCode")& VBCRLF & rs("CountryName")
response.Write strAddress

//--------------- ResponseType 3 ---------

elseif ResponseType = "3" then
do until rs.EOF
Response.Write ("<option value='" & rs(0) & "'>" & rs(1) & "</option>")
rs.Movenext
loop

each one of them are giving me some result with the xmlhttp.

but it is not good because now, each time i will want kind of result i will have to create a new response.

i'm searching for new and good way to use the ajax for alot of things but with smart thinking, if anypne have any idea or suggestions 4 me i will thank u.

roee.
[1840 byte] By [roee] at [2007-11-11 11:50:34]