萨拉姆aleykum,我想要在这里使用mappage路线调用一个AJAX服务器端方法,但它总是说代码C#:调用AJAX服务器端方法与mappage路线C#
[System.Web.Services.WebMethod]
public static bool RemovePhotofromAlbum(string list_photos_hotel)
{
.....
return true;
}
这里的jQuery代码想:
function RemovePhotofromAlbum(list_photos_hotel) {
$.ajax({
type: "POST",
url: $(location).attr('pathname') + "/RemovePhotofromAlbum",
data: '{list_photos_room_type: "' + list_photos_hotel + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
....
},
failure: function (response) {
alert(response.d);
}
});
}
不使用它的工作mappage路线。 但在这里我想要使用映射路线 我知道ajax方法中的URL存在问题,但我不知道如何解决它。 任何帮助,将不胜感激。 :)
没有,这里'$(位置).attr( '路径')'我试图访问方法示例的url:www.xxxx.com/mappagename并比方法名称:“/ RemovePhotofromAlbum” –
首先在变量中创建完整路径,然后发送到ajax调用 – Tauqeer
请举例说明 –