我有两个变量current_min
和current_max
。我正在设置他们的值,但AJAX不起作用。
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);
}
});
我检查了控制台,显示的错误是:
no element found
no element found
答案 0 :(得分:1)
使用AJAX发送数据的正确方法是
data: { name: "John", location: "Boston" }
所以试试这个
$.ajax({
type: "POST",
url: "v.php",
data: {"city": current_min},
success: function(response) {
alert(response);
$('#result').html(response);
}
});