현재 자바 스크립트에서 aspx.cs의 메소드를 호출하려고합니다.자바 스크립트에서 aspx.cs 메소드를 호출합니다.
자바 스크립트 : 아래
내가 현재 가지고있는 것입니다function loadPins(passValue) {
callServer2("myMethod", passValue);
}
function callServer2(requestMethod, clientRequest) {
var pageMethod = "Default.aspx/" + requestMethod;
$.ajax({
type: 'POST',
data: clientRequest,
dataType: 'JSON',
contentType: 'application/json',
url: pageMethod , //Method to call
success: function (result, status) {
alert("success");
},
error: function (xhr, status, error) {
alert("ERROR");
}
});
}
내 aspx.cs
: 나는 그것을 호출하고 CallServer2
를 입력하지만 결코 칠 것 같다 참조 디버깅
[WebMethod]
public static string myMethod(string passedVal)
{
value = passedVal;
return "true";
}
내 중단 점 내 aspx. 내 성공 또는 오류 메시지 알림도 표시되지 않습니다.
제안 사항? 내가 현재 무엇입니까
오류 :
error - <html>
<head>
<title> Unknow we method myMethod.<br>Parameter name:
methodName</title>
<style>
body{font-family:verdana";font-weight:normal;font-size:
.7em;color:black}
p
{font-family:"Verdana";font-weightbold;color:black;margin-top: -5px}
b{font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1{
font-family:"veranda";font-weight:normal;font-size:18pt;colour:red}
H2{
font-family:"Verdana";font-weight:normal ;font-size:14pt color:maroon}
pre{font-family:"Lucida Console";font-size .9em}
.marker{font-weight:bold;color:black;text-decoration:none;}
.version{color:gray;}
.error{margin-bottom:10px}
.expandable{text-decoration:underline, font-weight:bold; color:navy; cursor:hand;}
</style>
<head>
<code>
An unhanded exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
...
* 참고 나는 당신의 페이지에 있어야 그것이 말하는 모든
코드를 다시 확인하지 않으면 서버 기능을 통해 디버그를 수행 할 수 있습니까? –
또한 업데이트 $ .ajax 함수를 표시 할 수 있습니까? –