471,050 Members | 1,105 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,050 software developers and data experts.

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
0 993

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 | 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 | last post: by
terryble
reply views Thread by terryble | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.