0
크로스 도메인 요청 WCF 데이터 서비스가 json 데이터로 응답하지만 자바 스크립트 오류가 발생합니다 ';' 브라우저의. 이 오류로 인해 $ .ajax 성공 처리기가 실행되지 않습니다. 이 문제의 원인을 파악할 수 없습니다.jquery wcf 데이터 서비스 jsonp - 자바 스크립트 오류 ';'예상
피들러
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 368
Content-Type: application/json;charset=utf-8
Server: Microsoft-IIS/7.5
DataServiceVersion: 2.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 26 Mar 2011 00:19:20 GMT
{
"d" : {
"results": [
{
"__metadata": {
"uri": "http://subdomain.domain.com/services/Service1.svc/Surveys(410)", "type": "SurveyModel.Survey"
}, "OBJECTID": 410, "ID_Reviewer": "007", "ID_Reviewee": "007", "Rating": 9, "Question_A_Text": "test 1", "Question_B_Text": "test 2", "DateSubmitted": "\/Date(1301034211000)\/"
}
]
}
}
.html 중에서
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.ajax({
url: "http://subdomain.domain.com/services/Service1.svc/Surveys/?$format=json",
dataType: "jsonp",
success: function (data) {
alert("success");
}
});
});
</script>
</head>
<body>
</body>
</html>
네가 맞다. 와일드 카드 맞아. URL에서 $ callback 매개 변수를 잊어 버렸습니다. http : //../myservice.svc/surveys? $ callback = callback & $ format = json – dm80
유용한 링크 - http://stephenwalther.com/blog/archive/2010/04/01/netflix-jquery-jsonp-and -odata.aspx – dm80