我想对我的服务器进行POST或GET以使json恢复为警报,但它不起作用。警报显示每次尝试“[object Object]”
这是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Loading data into a PhoneGap app</title>
</head>
<body>
</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
$(document).ready(function(){
$.ajax({
url: 'http://lars-dev.de/test.php',
dataType: 'application/json',
success: function(data) {
alert(data);
console.log('In callback');
console.log(data);
},
error: function(error) {
alert(error);
console.log(error);
}
});
});
</script>
</html>