I have a datagrid that i want to submit all the rows to a php url and i can get it to submit but it asks the success for each one i submit. i know im missing something easy. Here is my code.
function getCart() {
var ids = [];
var titles = [];
var descritptions = [];
var output = "";
var rows = $('#cart').datagrid('getRows');
var emailfrom = $('#emailfrom').val();
var datastring = "ID=" + rows[i].ID + "&copies=" + rows[i].copies + "&emailfrom=" + emailfrom +"";
for (var i = 0; i < rows.length; i++)
{
$.ajax({
type: "POST",
url:"echo.php",
data:datastring,
cache: false,
success: function(result)
{
$.messager.confirm('Confirm','Are you sure you want to Submit cart?',
function (r)
{
if (r)
{
$.messager.show({
title:'Job Submitted',
msg:'Thank you for your job submittal.',
timeout:5000,
showType:'slide'
}); //messager.show
setTimeout( function() {location.reload(); }, 5000);
}
else
{
return false;
}
});
}
});
}