Ajax Post Not Sending Form Data
I have the following AJAX POST below, for some reason looking at my logging (server side) the request it's sending is is blank {} not JSON data is sent. I have exhausted all possib
Solution 1:
serialize()
returns key/value formatted URL encoded data (x-www-form-urlencoded), not JSON. If your server side requires JSON then you need to change your data parameter:
$.ajax({
...
data : JSON.stringify({ input_a : 'value a', input_b : 'value b' }),
...
});
See this question for how to convert a form into JSON automatically.
Post a Comment for "Ajax Post Not Sending Form Data"