467,207 Members | 1,283 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,207 developers. It's quick & easy.

Reading Web Service Response with Javascript

Hello
im trying to do an http post via javascript to my web service i can view the
xml response but cant seem to get null objects when i use an xpath with it :?
heres my code. I appreciate any help i can get
<script language=javascript type="text/javascript">
function postdata(){
var url="http://localhost:3601/WebSite2/hint.asmx/hint";
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open('POST', url , true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send("Term=e");
xmlHttp.onreadystatechange = checkState;
}
function checkState(){
if(xmlHttp.readyState=="complete"||xmlHttp.readySt ate==4){
placeHint(xmlHttp.responseText);
//I've tried using resoponseXML as well but the response is the same
}
}
//THIS IS WHERE THE PROBLEM IS
function placeHint(xmlresponse) {
oDoc =new ActiveXObject("MSXML2.DOMDocument.4.0")
oDoc.async = false;
var sNamespaces = "xmlns:ph='http://microsoft.com/webservices/'";
oDoc.setProperty("SelectionNamespaces",sNamespaces );
oDoc.load(xmlresponse)
resultNode = oDoc.selectSingleNode("/*/ph:string").text;
alert(resultNode);
}
Jul 1 '06 #1
  • viewed: 927
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Casper Hornstrup | last post: by
2 posts views Thread by shadow.demon@gmail.com | last post: by
1 post views Thread by evilme | last post: by
dmjpro
3 posts views Thread by dmjpro | last post: by
1 post views Thread by jeewant@gmail.com | last post: by
terryble
reply views Thread by terryble | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.