Javascript jquery移动ajax xml post
这可以用于xml解析,因为我使用json进行了解析,但它没有显示来自web服务的任何响应。 这是Web服务的状态 http/1.1 405方法不允许113msJavascript jquery移动ajax xml post,javascript,ajax,jquery,jquery-mobile,Javascript,Ajax,Jquery,Jquery Mobile,这可以用于xml解析,因为我使用json进行了解析,但它没有显示来自web服务的任何响应。 这是Web服务的状态 http/1.1 405方法不允许113ms $j.ajax({ 键入:“获取”, async:false, url:“Service1.asmx”, 数据类型:“XML”, //contentType:'application/json', 成功:功能(数据){ $j.each(数据、函数(索引、元素){ 警报(“此处成功:+元素”); //$j(“#json”).append(在
$j.ajax({
键入:“获取”,
async:false,
url:“Service1.asmx”,
数据类型:“XML”,
//contentType:'application/json',
成功:功能(数据){
$j.each(数据、函数(索引、元素){
警报(“此处成功:+元素”);
//$j(“#json”).append(在ajax的url
参数中使用您的方法名,例如:url:“Service.asmx/ConversionRate”
如果您正在调用不同域中的web服务,例如:您正在编写ajax函数的.js文件位于www.abc.com
中,并且您正在www.xyz.com
中调用web服务(即)跨域调用,则需要使用如下所示的服务器路由代理,或者使用jsonp,因为浏览器不允许跨域调用
var url = 'http://www.webservicex.net/Service1.asmx/ConversionRate;
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from xml where url="' + url + '"') + '&format=json&callback=?';
$j.ajax({
type: "GET",
async: false,
url: yql,
dataType: 'XML',
//contentType:'application/json',
success: function (data) {
if(data.query.results){
var result = data.query.results.double.content.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
$j.each(result, function (index, element) {
alert("Successful here: " + element);
//$j('#json').append("<li'>"+element+"</li>");
});
}
}
});
非常感谢它的工作,所以你能告诉http 500错误吗
var url = 'http://www.webservicex.net/Service1.asmx/ConversionRate;
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from xml where url="' + url + '"') + '&format=json&callback=?';
$j.ajax({
type: "GET",
async: false,
url: yql,
dataType: 'XML',
//contentType:'application/json',
success: function (data) {
if(data.query.results){
var result = data.query.results.double.content.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
$j.each(result, function (index, element) {
alert("Successful here: " + element);
//$j('#json').append("<li'>"+element+"</li>");
});
}
}
});
$j.ajax({
type: "GET",
async: false,
url: "Service1.asmx/GetConversion",
dataType: 'XML',
//contentType:'application/json',
success: function (data) {
$j.each(data, function (index, element) {
alert("Successful here: " + element);
//$j('#json').append("<li'>"+element+"</li>");
});
}
});