【发布时间】:2017-05-30 21:52:12
【问题描述】:
<script>
$(document).ready(function() {
$.ajax({url: "http://somedomain/app/district.php", success: function(result){
$("#district").html(result);
}});
$.ajax({url: "http://somedomain/app/category.php", success: function(result){
$("#crop-category").html(result);
}});
$('#district').change(function(){
var value=$('#district').val();
$('#upazila').parent().find('span').html("<span> </span>");
$.ajax({
url: "http://somedomain/app/upazila.php",
type: "get", //send it through get method
data:{value},
success: function(response) {
$("#upazila").html(response);
},
error: function(xhr) {
//Do Something to handle error
}
});
});
});
</script>
这是我的 jquery 代码,我正在构建 android 应用程序。 对于前 2 个 ajax 请求,我得到了值,但是当我通过 get 请求传递一些变量时,代码不起作用。在调试心情它说 Uncaught SyntaxError: Unexpected token } index.html:36 这是
数据:{值},
但它在浏览器上运行良好...... 请帮忙。
【问题讨论】:
标签: javascript android jquery cordova jquery-mobile