jquery - How to use the .serialize() method to send form values to PHP via an AJAX request -


I am using the

.erialize () method, sorting the values ​​of my form And send them to my PHP script in an AJAX request.

My form:

  & lt; Form name = "myform" action = "" method = "post" class = "form" & gt; & Lt; Input type = "text" name = "one" value = "" /> & Lt; Input type = "text" name = "two" value = "" /> & Lt; Input type = "text" name = "three" value = "" /> & Lt; Input type = "submit" name = "submit" value = "submit" /> & Lt; / Form & gt;  

My AJAX request:

  $ ('.form') .on ('submit', function (e) {$ .ajax ({type: 'POST', url: ajax_url, datatype: 'jason', data: {'action': $ action, 'querystr': $ (this) .serialize ()} ...  

In my PHP script, I was hoping to do something like $ one = $ _REQUEST ['a'] but when I do this $ one < / Code> is zero .

why not $ _ request ['a'] is not the value of input in my form field?

PHP error $ Params ['a'];

/ Div>

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -