I have a Javascript array that I would like to add to the message array when submitting the form. A Javascript array should be added in addition to other variables already submitted from the form. Is there a way to do this in jQuery?
Ref.
the form:
<form id="my-form" action="/create.php" method="post"> <input id="first_name" type="text" /> <input id="last_name" type="text" /> </form>
Javascript array:
<script type="text/javascript"> var external_ids = [{"name":"SSN","value":"555-55-5555"}, {"name":"PID","value":"GBNT22"}]; </script>
Here is what I would like to get, if possible, the resulting PHP array $ _POST:
Array ( [first_name] => John [last_name] => Smith [external_ids]=> ( [SSN] => 555-55-5555 [PID] => GBNT22 ) )
source share