asp.net中js和jquery調用ashx的不同方法分享
更新時間:2013年06月07日 11:21:31 作者:
asp.net中js和jquery調用ashx的不同方法分享,需要的朋友可以參考一下
=============js================
var xhr = new XMLHttpRequest();
xhr.open("get", 'Controls/gengCart.ashx?CartID=' + input + '&count=' + inp, true);
xhr.setRequestHeader("If-Modified-Since", "0");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var result = xhr.responseText;
var json = eval("(" + result + ")");
alert(js.name);
}
};
xhr.send(null);
============jquery=====================
$.post('Controls/Cart.ashx', { "productID":<%= GetID %>,"count":"1","userID":'<%= uid %>' }, function (data,statu) {
if (statu == 'success') {
if(data=="false"){
alert("請登錄后再進行此操作");
}
else{
window.location="gwc.aspx?uid="+'<%= uid%>';
}
}
})
復制代碼 代碼如下:
var xhr = new XMLHttpRequest();
xhr.open("get", 'Controls/gengCart.ashx?CartID=' + input + '&count=' + inp, true);
xhr.setRequestHeader("If-Modified-Since", "0");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var result = xhr.responseText;
var json = eval("(" + result + ")");
alert(js.name);
}
};
xhr.send(null);
============jquery=====================
復制代碼 代碼如下:
$.post('Controls/Cart.ashx', { "productID":<%= GetID %>,"count":"1","userID":'<%= uid %>' }, function (data,statu) {
if (statu == 'success') {
if(data=="false"){
alert("請登錄后再進行此操作");
}
else{
window.location="gwc.aspx?uid="+'<%= uid%>';
}
}
})
相關文章
asp.net代碼中修改web.config節(jié)點的具體方法
在有些情況下,要在代碼中讀取一種全局變量,把這種全局變量放在web.config是一種常見的手段。2013-06-06適用與firefox ASP.NET無刷新二級聯(lián)動下拉列表
適用與firefox ASP.NET無刷新二級聯(lián)動下拉列表...2007-08-08.NET 6開發(fā)TodoList應用之實現(xiàn)查詢排序
這篇文章主要介紹了如何通過.NET 6實現(xiàn)查詢排序功能,文中的示例代碼講解詳細,對我們學習.NET 6有一定的幫助,感興趣的同學可以了解一下2022-01-01.Net6集成IdentityServer4?+AspNetCore?Identity讀取數(shù)據(jù)表用戶且鑒權授權管理A
這篇文章主要介紹了.Net6集成IdentityServer4與AspNetCore?Identity讀取數(shù)據(jù)表用戶且鑒權授權管理API,IdentityServer4?實現(xiàn)鑒權、授權,AspNetCore?Identity實現(xiàn)數(shù)據(jù)庫用戶管理表直接生成,下文詳情需要朋友可以參考一下2022-07-07白刃之戰(zhàn):PHP vs. ASP.NET(節(jié)選)-架構比較
白刃之戰(zhàn):PHP vs. ASP.NET(節(jié)選)-架構比較...2006-09-09