I have an arrey of items to insert in my cart, and I call N times a WebMethod
with Ajax. When I finish to insert them, I need redirect to summary page.
function SellAll(){
$.each(x,function (index, value) {
$.ajax({
type: "POST",
url: "find.aspx/AddItem",
data: "{'id': '" + value + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: "false",
success: function (response) {
...
}
});
})
document.location.href = "summary.aspx";
};
If I call the function SellAll
, the summery page is empty, but if I remove the redirect and I execute the function and I go (manually) in the summary page, I find my cart with items.
How can I fix this error?
Thanks!