Gaurry Gaurry - 29 days ago 10
Ajax Question

on page load event $.ajax function sends ajax request. while we looks the url in the Global.asax file it is different Url

$(function () {

$.ajax({
url: "MySettings/ChangePassword",
type: "post",
success: function (response) {
$('#view-settings').html(response);
hideFlyWithMessage("Loaded");
}
});
}


when the above code is executed it send request to
"MySettings/Index/MySettings/ChangePassWord"
url.

It clearly shows in console window.

Answer

If you place slash(/) at beginning, then ajax url treat it as hostname/yourURL

So, change url as below

$.ajax({
            url: "/MySettings/ChangePassword",
.....
});