1
클라이언트 메서드에 GetNextImage 메서드가 있습니다. ASPX 페이지에서 다음 코드가 있습니다.GET 요청을 사용하여 u0027GetNextImage u0027 메서드를 호출하려고했으나 허용되지 않았습니다.
function slideshow() {
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "/RollingScreen.aspx/sample",
dataType: "json",
data: "{}",
success: function (data) {
//this changes the image on the web page
$('#imgSlideShow').attr("src","~/Images/1.png");
//fires another sleep/image cycle
setTimeout(slideshow(), 5000);
},
error: function (result) {
alert(result.message);
}
});
}
$(document).ready(function() {
//Kicks the slideshow
slideshow();
});
아래와 같은 오류가 표시됩니다.
{"Message":"An attempt was made to call the method \u0027GetNextImage\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
제발 도와주세요. 미리 감사드립니다.
"POST"와 같은 오류가 발생하는지 확인하십시오. –
@Kirill : 고마워요 ... 많이 작동했습니다 ... 이제는 setTimeout (slideshow()) 오류가 발생합니다. , 5000); javascript 언급에서 ... 제발 도와주세요 제발 ... – JItendra
'setTimeout (slideshow, 5000)'해야합니다. – Barmar