How To Retrieve $_post Variable From Jquery Serializearray()
I have a problem in retrieving the $_POST data from jquery serializeArray();. I tried to for loop the $_POST to get the data but failed. This is my JavaScript code: function up
Solution 1:
You don't need to nest your serialized object; that seems to be what's causing the error. Just set your post call to:
$.post(url, fields, function(data) {
alert(data);
}, "html");
That should work; you might also want to change from using serializeArray
to using serialize
.
Once this is properly configured, if you have:
<input name="foo" value="bar" />
It can be accessed as:
$_POST["foo"]; //bar
Post a Comment for "How To Retrieve $_post Variable From Jquery Serializearray()"