In the code below, I've used .serialize()
to encode all of my form inputs as a string, which I then post to the server:
$.ajax({
type: "post",
url: wp_urls.ajax_url,
data: {
action: "submit_form",
form: $("#myForm").serialize()
}
});
I assumed the serialized form fields (stored in the form
property of the data
object) would become parameters of the query string. However, the only parameters being sent to the server are action
and form
with my serialized string being a value of the form
field.
Is there a way to parse my serialized string into HTTP POST variables, before it hits the server or is there another way to handle the $_POST["form"]
variable with server-side code?