我正在为我的Sample Mobile Application执行以下Ajax代码。我得到一个语法错误的响应Xml,我可以在firebug控制台上看到它。
script type="text/javascript" charset="utf-8">
function receive(result){
console.log(result)
}
$( document ).on( "pagecreate", "#home", function( event ) {
$("#submit").bind("tap",function(){
var FromCurrency = $("#fromcurrency option:selected").val();
console.log(FromCurrency)
var ToCurrency = $("#tocurrency option:selected").val();
console.log(ToCurrency)
$.ajax({
crossDomain: true,
type:"GET",
contentType: "content/xml; charset=utf-8",
async:false,
url: "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate",
data: {FromCurrency :FromCurrency,ToCurrency :ToCurrency},
dataType: "jsonp",
jsonpCallback: "receive",
success: function(result){
console.log("Success")
},
error: function(XMLHttpRequest, textStatus, errorThrown){
console.log(XMLHttpRequest, textStatus, errorThrown)
console.log(XMLHttpRequest.responseType)
}
});
});
});
</script>
响应Xml:
<?xml version="1.0" encoding="utf-8"?>
<double xmlns="http://www.webserviceX.NET/">61.155</double>
错误截图: http://s28.postimg.org/f11gvkgyl/Error.jpg
请帮我找出我的错误。我被困在这里超过三天。谢谢!