Okay, so I'm trying to find out if it's possible to post serialize() and other data that's outside the form.
Here's what I though would work, but it only sends 'wordlist' and not the form data.
$.post("page.php",( $('#myForm').serialize(), { 'wordlist': wordlist }));
Anyone have any ideas?
You can use
serializeArray
[docs] and add the additional data:In new version of jquery, could done it via following steps:
serializeArray()
push()
or similar methods to add additional params to the array,$.param(arr)
to get serialized string, which could be used as jquery ajax'sdata
param.Example code:
An alternative solution, in case you are needing to do this on an ajax file upload:
OR even simpler.
You can use this
When you want to add a javascript object to the form data, you can use the following code
Or if you add the method serializeObject(), you can do the following