不允许获取方法从jQuery ajax调用wcf服务时出现异常 [英] Getting method not allowed Exception while calling the wcf service from the jQuery ajax
本文介绍了不允许获取方法从jQuery ajax调用wcf服务时出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从jQuery ajax调用wcf服务时,我收到Method not allowed异常。
任何人都可以指导我。
$。ajax({
type: POST, // GET或POST或PUT或DELETE动词
url:' http:// vsp065:5858 / Service1.svc / GetData',
data:{value: 5},
contentType:' application / json; charset = utf-8', // 发送到服务器的内容类型
dataType:' json', // 来自服务器的预期数据格式
processdata: true , // 对错
成功: function (msg){ // 成功的服务电话
调试器;
},
错误: function (xhr,status,e){
alert(e);
} // 当服务呼叫失败时
});
解决方案
.ajax({
type: POST, // GET或POST或PUT或DELETE动词
url:' http:// vsp065:5858 / Service1.svc / GetData',
数据:{值: 5},
contentType:' application / json; charset = utf-8', // 发送到服务器的内容类型
dataType:' json', // 来自服务器的预期数据格式
processdata: true , // 正确或错误
成功: function (msg){ // 在成功的服务电话上
调试器;
},
错误: function (xhr,status,e){
alert(e);
} // 当服务呼叫失败时
});
Hi,
I am getting the Method not allowed exception while calling the wcf service from jQuery ajax.
Can any one guide me.
$.ajax({
type: "POST", //GET or POST or PUT or DELETE verb
url: 'http://vsp065:5858/Service1.svc/GetData',
data: { value: "5" },
contentType: 'application/json; charset=utf-8', // content type sent to server
dataType: 'json', //Expected data format from server
processdata: true, //True or False
success: function (msg) {//On Successfull service call
debugger;
},
error: function (xhr, status, e) {
alert(e);
} // When Service call fails
});
解决方案
.ajax({ type: "POST", //GET or POST or PUT or DELETE verb url: 'http://vsp065:5858/Service1.svc/GetData', data: { value: "5" }, contentType: 'application/json; charset=utf-8', // content type sent to server dataType: 'json', //Expected data format from server processdata: true, //True or False success: function (msg) {//On Successfull service call debugger; }, error: function (xhr, status, e) { alert(e); } // When Service call fails });
这篇关于不允许获取方法从jQuery ajax调用wcf服务时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文