0
http 게시를 사용하여 데이터를 게이트웨이로 전달하는 html 및 jquery 코드를 사용하여 하나의 간단한 웹 페이지를 개발했습니다. 서버로부터의 응답은 json 객체, { "remarks": "SUCCEED"}입니다. 하지만, 내 웹 페이지는 항상 관련 응답 아래JSON POST가 응답 데이터를 가져 오지 못했습니다.
내 웹 페이지 코드는
<!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>
사람의 도움이 /이 날 조언을 할 수 있습니다를 가져 오지 못했습니다?
'http : // localhost : 8091 /'에서 스크립트를 실행하고 있습니까? –
Firefox/Firebug를 사용하여 HTTP 응답을 보았습니까? – Steve