Send Multiple Values From Ajax To Php In Url With Get
I want to send 2 values to php using ajax. When I use one variable, it works fine, but when I use 2 variables, the query no longer works in the php file. $.ajax({ url:'page.ph
Solution 1:
I'm sure it's not related, but there is no reason to build your own query string. Use the data
property instead, which as Barmar points out will properly URL encode your parameters:
$.ajax({
url: 'page.php',
data: {
'suplier_id': suplierNameMain,
'quality_id': qualityNameMain
},
success: function(data) {
/* Whatever */
}
});
Note that method
from your example isn't valid for jQuery (there is a type
setting to switch between GET
and POST
), but GET
is the default so you might as well exclude it altogether.
Post a Comment for "Send Multiple Values From Ajax To Php In Url With Get"