标签:contex $.ajax response pen err nbsp delete erro header
1.post请求
$.ajax({ type: ‘post‘, url: ‘/GetProdects.ashx‘, async: true,
//data: {id:‘2‘} 请求参数 success: function (result) { var json = JSON.parse(result)[‘Head‘]; prodectVue.prodects = json; }, error: function () { setContainer(‘ERROR!‘); } });
2.get请求
$.ajax({ type: ‘get‘, url: ‘/DeleteProdect.ashx?id=‘+2, async: true, success: function (result) { //alert(123) if (result == ‘1‘) { alert(‘删除成功‘); showProdect(); } else alert(‘系统繁忙‘); }, error: function () { setContainer(‘ERROR!‘); } });
3.ajax跨站请求
$.ajax({ type: ‘get‘, url: ‘http://域名/DeleteProdect.ashx?id=‘+id, async: true, success: function (result) { //alert(123) if (result == ‘1‘) { alert(‘删除成功‘); showProdect(); } else alert(‘系统繁忙‘); }, error: function () { setContainer(‘ERROR!‘); } });
在处理函数中需要加入:context.Response.AppendHeader("Access-Control-Allow-Origin", "*");
标签:contex $.ajax response pen err nbsp delete erro header
原文地址:http://www.cnblogs.com/zhuxiang1633/p/7619701.html