我使用 html 和 jquery 代码开发了一个简单的网页,该网页将使用 http post 将数据传递到我的网关。来自服务器的响应是 json 对象,{"remarks":"SUCCEED"}。但是,我的网页总是无法得到相关响应
下面是我的网页代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Loading data into a PhoneGap ap2p</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jquery.jsonp.js"></script>
</head>
<body>
<ul id="your-tweets"></ul>
</body>
<script>
$(document).ready(function(){
$.ajax({
type: 'POST',
url: 'http://localhost:8091/gateway/jjh/v1.0/login?userid=ccc&password=pwd',
crossDomain: true,
data: 'userid=wcc',
dataType: 'json',
success: function(responseData, textStatus, jqXHR) {
alert("Success>>");
var obj = responseData;
alert(obj.remarks);
},
error: function (responseData, textStatus, errorThrown) {
alert('POST failed.');
}
});
});
</script>
</html>
任何人都可以帮助/建议我吗?