Reputation: 85
I have two variables, current_min
and current_max
. I am setting their values but AJAX is not working.
var current_min = $('#min').val();
var current_max = $('#max').val();
//alert(current_min+current_max);
$.ajax({
type: "POST",
url: "v.php",
data: "city=" + current_min,
success: function(response) {
alert(response);
$('#result').html(response);
}
});
I have checked the console and the error showing is this:
no element found
no element found
Upvotes: 0
Views: 57
Reputation: 5297
Correct Way to Send Data With AJAX Is
data: { name: "John", location: "Boston" }
So try like this
$.ajax({
type: "POST",
url: "v.php",
data: {"city": current_min},
success: function(response) {
alert(response);
$('#result').html(response);
}
});
Upvotes: 1