相同的代码在mac上使用chrome:
$.ajax({
url : 'change.php',
method : 'POST',
data : {"id" : id, 'name': name},
success : function( response ) {
alert(response)
}
});
未显示任何提示。我假设它不成功。有什么想法吗?
开发人员的控制台中没有显示错误
答案 0 :(得分:-1)
试试这个:
test.php的
<?php
print_r($_POST);
?>
的index.html
<script src="jquery-3.0.0.js"></script>
<script>
var p1=1;
var p2 = 23;
$.ajax({
url : "test.php",
method : "POST",
data : {param1:p1,param2:p2},
success : function( response ) {
console.log(response);
alert(response);
}
});
</script>