$.ajax(
{
type: "GET",
url: 'Home/GetMsg',
success: function (result) { },
error: function (req, status, error) {}
});
By Default URL taking relative path for Home/GetMsg. I am calling this function from different controller/view which disturb the URL.
How can i mention absolute and relative path here. i did tried with
URL: ‘http://abc.com/Home/Getmsg’ but again its not working
Use a helper:
or if this is in a separate javascript file where you cannot use server side helpers, you could use helpers to generate the url on some existing DOM element using HTML5 data-* attributes:
and then in your js: