JQuyer $.post 與 $.ajax 訪問WCF ajax service 時(shí)的問題需要注意的地方
$.post('<%=this.AppPath %>DataService/InventoryUIService.svc/Rename', ///location.protocol + "http://" + location.host + location.pathname + "/Rename",
odata,
function (result) {
$dialogProcessing.dialog("close");
if (result.Success) {
alert("Success");
}
else {
var msg = "Your submit fauiler, Detail message is:" + result.ErrorMessage;
window.alert(msg);
}
},
"json");
$.ajax({
url: '<%=this.AppPath %>DataService/InventoryUIService.svc/Rename',
type: 'POST',
contentType: 'application/json',
dataType: 'json',
data: odata,
success: function (result) {
if (result.Success) {
alert("Success");
}
else {
var msg = "Your submit fauiler, Detail message is:" + result.ErrorMessage;
window.alert(msg);
}
},
error: function (jqXHR, textStatus, errorThrown) {
var msg = "Your submit throw a error, \r\nError message is:" + $(jqXHR.responseText).text();
window.alert(msg);
}
});
TCP Trace截圖
$.post:
$.ajax:
感覺$.post是用來提交forms的,而要跟wcf ajax service訪問,還必須得用$.ajax來指定Content-Type.
后來找到的資料: http://stackoverflow.com/questions/2845459/jquery-how-to-make-post-use-contenttype-application-json
相關(guān)文章
EasyUi tabs的高度與寬度根據(jù)IE窗口的變化自適應(yīng)代碼
EasyUi tabs的高度與寬度根據(jù)IE窗口的變化自適應(yīng)代碼,需要的朋友可以參考下。2010-10-10深入理解jquery自定義動(dòng)畫animate()
下面小編就為大家?guī)硪黄钊肜斫鈐query自定義動(dòng)畫animate()。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05制作高質(zhì)量的JQuery Plugin 插件的方法
最近jquery非常流行,想個(gè)性化定制一些功能,就可以將代碼寫成插件的形式,方便使用與修改。2010-04-04web前端設(shè)計(jì)師們常用的jQuery特效插件匯總
這篇文章主要匯總了web前端設(shè)計(jì)師們常用的jQuery特效插件,需要的朋友可以參考下2014-12-12關(guān)注jquery技巧提高jquery技能(前端開發(fā)必學(xué))
本文給大家介紹jquery前端開發(fā)關(guān)注jquery技巧提高jquery技能,對(duì)jquery前端開發(fā)感興趣的朋友可以參考下本文2015-11-11Jquery實(shí)現(xiàn)由下向上展開效果的例子
這篇文章主要介紹了Jquery實(shí)現(xiàn)由下向上展開效果的例子,本文同時(shí)講解了向下展開的例子,需要的朋友可以參考下2014-12-12