사용하여 웹 서비스에서 JSON 받기 그래서 내 자바 스크립트는 다음과 같습니다jQuery를
try {
var response = $.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "BudgService.asmx/LoadDetail",
data: "{'building': '63170', 'CurrentYear':'2014'}",
dataType: "json"
});
$.when(response).then(function() {
loadData();
});
} catch (err) {
alert(err);
}
function LoadData() {
alert('here');
}
그리고 웹 서비스
[ScriptMethod]
public string LoadDetail(string building, string CurrentYear) {
return "[{color:\"red\", value: \"#f00\"}]";
}
하지만이 loadData 기능에 결코 아무것도 응답으로 채워 않겠다.
무엇이 누락 되었습니까?
브라우저에서'BudgService.asmx/LoadDetail'을 직접 방문하면 어떻게됩니까? –