나는이 클라이언트 측이 :문자열이 아닌 매개 변수가있는 jQuery로 WebMethod를 소비하는 방법은 무엇입니까?
$(document).ready(function() {
var $checkboxes = $('[type=checkbox]');
$checkboxes.click(function() {
$checkbox = $(this);
$.ajax({
type: "POST",
url: "Page.aspx/Method",
data: "{id:'" + $checkbox.attr("id") + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert('success!');
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert('An error occurred that prevented your change being saved: ' + err.Message);
}
});
});
});
을 그리고 난이 서버 측이 :
[WebMethod]
public static void Method(String id)
{
Guid guidID = new Guid(classid));
//...........
}
을하지만 강력하게 입력 한의 WebMethod 서명 할 원합니다 :
[WebMethod]
public static void Method(Guid id)
{
//...........
}
을
이 작업을 수행하는 가장 좋은 방법은 무엇입니까?