I가 다음 코드, 웹 메소드에 매개 변수를 전달하고,이 (가) 결과를 검색하기위한 JQuery와 아약스 :umbraco 템플릿에서 JSON으로 데이터를 얻을
<script type="text/javascript">
$(document).ready(function() {
$('#<%=btnSignup.ClientID %>').click(function() {
var dataString = JSON.stringify({
firstName: $("#SignupFirstName").val(),
lastName: $("#SignupLastName").val(),
email: $("#SignupEmail").val(),
password: $("#SignupPassword").val()
});
$.ajax({
type: "POST",
url: "Signup.aspx/Signup",
data: dataString,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
beforeSend: function() {
// some code
},
success: function (result) {
$('#loading').hide();
if (result.hasOwnProperty("d")) { result = result.d; }//and some more code
}
});
return false;
});
});
</script>
및 웹 방법 :
[WebMethod]
public static SignupOutput Signup(string firstName, string lastName, string email, string password)
{
// execute some code and return an object for the json
}
메서드가 실행되고 있지 않습니다. 멋진 URL을 사용하고 있습니다. 코드를 잘못 작성하면 도움을주세요. 감사합니다. .
독립 실행 형 .cs 코드 숨김, 페이지 (.aspx.cs) 또는 usercontrol (.ascx.cs)이라는 웹 메서드가 선언 된 위치는 어디입니까? –