ashx:
public void ProcessRequest(HttpContext context)
{
string falg = "true";
int cid = Convert.ToInt32(context.Request["CartID"]);
Model.MCart mcart = new Model.MCart();
mcart = bcart.GetModel(cid);
mcart.Count = Convert.ToInt32(context.Request["count"]);
bcart.Update(mcart);
context.Response.Write(falg); }
js调用:
function check3(input) {
var inp = document.getElementById("iup_" + input).value;
var price = document.getElementById("pr_" + input).innerHTML;
document.getElementById("lbl_" + input).innerHTML = parseInt(inp) * parseFloat(price); $.post('Controls/gengCart.ashx', { "CartID": input, "count": inp }, function (data, statu) { if (statu == 'success') { alert(22);
} else {
alert(11);
}
})
}
js里面调用没反应,请问一下是什么原因。
public void ProcessRequest(HttpContext context)
{
string falg = "true";
int cid = Convert.ToInt32(context.Request["CartID"]);
Model.MCart mcart = new Model.MCart();
mcart = bcart.GetModel(cid);
mcart.Count = Convert.ToInt32(context.Request["count"]);
bcart.Update(mcart);
context.Response.Write(falg); }
js调用:
function check3(input) {
var inp = document.getElementById("iup_" + input).value;
var price = document.getElementById("pr_" + input).innerHTML;
document.getElementById("lbl_" + input).innerHTML = parseInt(inp) * parseFloat(price); $.post('Controls/gengCart.ashx', { "CartID": input, "count": inp }, function (data, statu) { if (statu == 'success') { alert(22);
} else {
alert(11);
}
})
}
js里面调用没反应,请问一下是什么原因。
function check3(input) {
var inp = document.getElementById("iup_" + input).value;
var price = document.getElementById("pr_" + input).innerHTML;
document.getElementById("lbl_" + input).innerHTML = parseInt(inp) * parseFloat(price);
//确认你上面3个控件都是存在的
alert('启动ajax'); ////是否执行到这句,如果没有执行那就是上面有控件ID不正确
$.ajax({ url: 'Controls/gengCart.ashx'
, data: { "CartID": input, "count": inp }
, type: 'POST'
, success: function (data, statu) { if (statu == 'success') { alert(22);
} else {
alert(11);
}
}
, error: function (xhr) {alert('动态页出错\n'+xhr.status+'\n'+xhr.responseText }
});
/* $.post('Controls/gengCart.ashx', { "CartID": input, "count": inp }, function (data, statu) { if (statu == 'success') { alert(22);
} else {
alert(11);
}
})*/
}