1、post请求
$.ajax({
type:'post',
url:'/GetProdects.ashx',
async:true,
//data:{id:'2'} 请求参数
success :function (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","*");