請參閱下面的代碼:見JSON通過AJAX
<script type="text/javascript" src="Javascript/json2.js"></script>
<script type="text/javascript" src="Javascript/jquery-1.11.1.min.js"></script>
<script type = "text/javascript">
function GetData() {
$.ajax({
type: "POST",
url: "JSONExample.aspx/GetPerson",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess(),
//async: false,
failure: function (response) {
alert('there was an error counting possibles')
}
});
function OnSuccess() {
return function (response) {
alert(response.d);
}
}
}
GetData()
</script>
我相信response.d返回desterilized JSON。我如何看到JSON,以便我可以將它自己殺滅爲.NET對象?
你會得到一個答案客戶端(Javascript)。你怎麼能使用一個.NET對象? – Goufalite