I’m trying to put some error trapping around a web service call which is not working.
example code from a function in the .._custom.js file:
var url = “http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=”
+ stock;
$.getJSON( url, function( data ){
//extract the results from json query results
resultXML = data.query.results.string;
//parse XML result
parser = new DOMParser();
doc = parser.parseFromString(resultXML, “text/xml”);
$xml = $(doc);
$result = $xml.find(‘GetQuoteResult’);
code = $result.attr(‘code’);
if (code == 200) { //success
alert(‘answer: ‘ + result);
$(‘#m1-GetStock-Answer’).text(result);
} else {
// failed
alert(‘Error: did not work’);
}
})
.success(function() { alert(“success”); })
.error(function() { alert(“error”); })
.complete(function() { alert(“complete”); });
but I get a runtime error of:
TypeError: Result of expression near ‘….success(function() { alert(…’ [undefined] is not a function on the ‘.success’ line
thoughts?
thanks..