当我使用 jquery 提交表单时,它显示一个空白页面,没有任何反应,日志中没有错误,update in the DB dosen't happen
HTML code:
<form id="editcart" method="post" action="">
<input type="text" id="pid" name="pid" value="${product.pid}" hidden/>
<input type="text" id="spid" name="spid" value="${product.sub_pid}" hidden/>
<input type="text" id="cartid" name="cartid" value="${product.cart_id}" hidden/>
<input type="text" id="quantity" name="quantity" value="${product.quantity}" disabled/>
<input type="button" value="Edit" class="enable"/>
<input type="submit" value="Save" class="save" hidden/>
</form>
jquery代码:
$('#editcart').submit(function() {
var quant = $('#quantity').val();
var pid = $('#pid').val();
var spid = $('#spid').val();
var cartid = $('#cartid').val();
$.ajax({
type: "post",
url: "/devilmaycry/register?action=editcart",
data: {pid:pid,quant:quant,spid:spid,cartid:cartid},
success:
function()
{
alert("Item quantity has been changed in cart");
},
error:
function(xhr)
{
if (xhr.responseText=="Stock left is less than desired")
alert("Stock is less");
else if(xhr.responseText=="Internal server error")
alert("item cannot be added , internal server error");
}
});
return false;
});
我无法在表单提交后得到它的功能,但肯定不会做它应该做的事情...... URL也保持不变
答案 0 :(得分:0)
It is assessed correctly the parameter 'action' on the page /devilmaycry/register ?