Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Read from an xml file

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Programmers Exchange
View previous topic :: View next topic  
Author Message
buttercupe
New one
New one


Joined: 26 Oct 2006
Posts: 1

PostPosted: Thu Oct 26, 2006 3:33 pm    Post subject: Read from an xml file Reply with quote

Hi Very Happy i'm fairly new programming in ajax.. Im doing an application in which I have to simulate a textbox autosuggest.. how can I achive that so far I have been able to read from an xml file but from a combobox.. my code is:

main.html
<script src="salesPerson.js"></script>
<form>
Enter name:
<input type="text" id="txt1" onkeyup="showSales(this.value)">
<div id="txtHint"></div>
</form>

salesPerson.js
var xmlHttp
function showSales(str)
{ xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{alert ("Browser does not support HTTP Request") return }
if (str.lenght == 0){document.getElementById("txtHint").innerHTML = ""
return}
var url="getSalesPerson.asp"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ document.getElementById("txtHint").innerHTML=xmlHttp.responseText}
}
function GetXmlHttpObject()
{ var objXMLHttp=null
if (window.XMLHttpRequest)
{objXMLHttp=new XMLHttpRequest()}
else if (window.ActiveXObject)
{ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}
return objXMLHttp}

salesPerson.asp
q = request.QueryString("q")
set xmlDoc = server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load(Server.MapPath("Salespeople.xml"))

set nodes = xmlDoc.selectNodes("SalesPeople/salesperson[sales_ID='" & q & "']")


for each x in nodes
response.write("" & x.getElementsByTagName("sales_Name") & ": ")
next

i'm stuck in the asp file... I have not been able to read if I enter any letter in the textbox...
thanx

Cool
Back to top
View user's profile Send private message
TeckniX
Light Frequent Poster
Light Frequent Poster


Joined: 07 Sep 2007
Posts: 7

PostPosted: Sat Sep 08, 2007 10:47 pm    Post subject: Reply with quote

Did you try to access the asp file directly, feeding it the correct querystring to see if you get an output from it?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Programmers Exchange All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert