Is it possible to send a form.serialize()
object and other paramters with a single $.ajax()
request?
Example:
$.ajax({
type : 'POST',
url : 'url',
data : {
$('#form').serialize(),
par1 : 1,
par2 : '2',
par3: 232
}
}
If not what's the best way to submit a form together with other parameters.
Thanks
Alternatively you could use form.serialize() with $.param(object) if you store your params in some object variable. The usage would be:
See http://api.jquery.com/jQuery.param for further reference.
I dont know but none of the above worked for me, Then i used this and it worked :
In form's serialized array it is stored as key value pair
We pushed the new value or values here in form variable and then we can pass this variable directly now.
I fix the problem with under statement ; send data with url same GET methode
and get value with $_REQUEST['value'] OR $_GET['id']
You can create an auxiliar form using jQuery with the content of another form and then add thath form other params so you only have to serialize it in the ajax call.
serialize()
effectively turns the form values into a valid querystring, as such you can simply append to the string:If you want to send data with form serialize you may try this