2
JSON 응답을 REST 웹 서비스에서 가져 와서 해당 데이터를 jQuery를 사용하여 html로 바인딩하려고합니다. 내 jquery에서 제공 한 웹 서비스 URL도 아닌 것처럼 보입니다. URL은 브라우저에서 JSON 데이터를 제공하지만 jQuery에서는 아무 것도 얻을 수 없으므로 잘 동작합니다. 나는 내 코드를 여기에 붙여 넣고 있는데, plz가 도와 주면 알려주지. ajax 호출에서 디버깅 스크립트가 직접 오류 섹션에 있습니다.jQuery를 사용하여 html 웹 서비스에서 오는 json 응답을 얻을 수 없습니다.
<script type="text/javascript">
$(document).ready(function() {
GetData();
});
function GetData() {
// alert(textblock.value);
$.ajax({
type: "GET",
url: "http://localhost:8092/api/Employees",
data: "{'employeeId'= '" + 1234 + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var results = $.parseJSON(msg.d);
alert(msg);
alert(results);
},
error: function (result) {
alert('here');
var tt = result.text;
alert(tt);
}
});
}
</script>
페이지에 http'에서 제공되는인가, 거짓 :
processData : 거짓, 비동기 나는 $의 아약스의 속성 아래에 추가 // 로컬 호스트 : 8092'도? – Pointy
데이터 매개 변수 일 수 있습니다 '{ "employeeId": "'+ 1234 + '"}'? – Vikram
@Pointy - 이것을 호출하는 html 페이지는 'http : // localhost : 39627/test/test5.htm'입니다. 웹 서비스 url using'http : // localhost : 8092 ' – rajcool111