I’m using 2 types of submit.
There is $.post
$.post('servers_side.php', { var1: var1, var2:var2},
function(result)
{
some code...
});
which sends separate variables to server side script.
And there is AjaxSubmit plugin which submits the whole form
$('#form').ajaxSubmit({success: function(result)
{
some code...
}
});
But now I have the following task let’s say I have a form and a few variables which I must submit at the same time.
So Is that possible to submit form + some variables together ?
Update
And here is how you can submit:
You can use
jQuery.param()to convert an array or an object into url-friendly name-value paris. You may also need to usejQuery.serialize()to convert form data into name-value paris. Here is how you can go about:Now
datacontains all data of your custom vars and form elements you can send in ajax request.