Reputation: 141
I wanted to get the form value that have been serialized and send it via AJAX call
var searchData = $("#SearchForm").serialize();
$.ajax({
type: "POST",
url: "search.php",
data: {
thedata : searchData,
page : "listPage="+pageNumber
},
success: function(searchResult){
$("#search-section").ajaxComplete(function() {
$(this).html(searchResult);
});
}
});
What should I do if I wanted to access data in the server side, usually if I only 1 data to be sent, I never define the data in .ajax, like...
...
data: searchData,
...
And I can access the serialized data in server side just like...
$_POST['inputValue1'];
$_POST['inputValue2'];
etc...
But how I should do it if I have 2 or more data to send via .ajax, since it must be defined first.
Upvotes: 1
Views: 664