0
내 jQuery의 :실패 HTTPGET 여기
$.ajax({
type: 'GET',
url: '/services/Service.asmx/FamilyHistory',
data: JSON.stringify({
userID: 10,
historyID: famid
}),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(val) {
var famHist = val.d;
alert(famHist.ID);
},
error: function() {
parent.$.jGrowl('<b>Failed</b>',
{
header: 'User Action:',
life: 3000
});
}
});
나의 등급 :
public sealed class FamilyHistoryEntity
{
public string ID { get; set; }
public string RelativeName { get; set; }
}
내 웹 서비스 :
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public FamilyHistoryEntity FamilyHistory(int userID, string historyID)
{
return GetFamilyHistory(historyID, userID); // returns a FamilyHistoryEntity class
}
문제는 웹 서비스에 중단 점을 만들지도 못하는데 jquery ajax 이벤트가 발생합니다.
asp.net webservice에 매개 변수를 전달하기 위해 json을 문자열 화해야합니다. –
@ Martin ok. 그래서 우리는 famid가 문자열 변수이고 int가 아님을 확신합니까? – spinon
확인 데이터 부분이 작동했습니다. 웹 서비스를 통과했습니다. 하지만 값을 반환 할 때 jquery는 오류 이벤트를 발생시킵니다. C# 클래스를 [serialize]해야합니까? –