I have wrong URL in my ajax calls.
$.ajax({
type: "POST",
url: "Home/GetDetails",
......
});
HomeController has action GetDetails().
All works fine, when I load page with URL htp://localhost/projectName Ajax URL is htp://localhost/projectName/Home/GetDetails
But after loading htp://localhost/projectName/Home/Index all my ajax calls are going to htp://localhost/projectName/Home/Home/GetDetails and thats wrong.
Please, how can I solve this?
You should use the Url Helper to generate your URLs...
$.ajax({
type: "POST",
url: "<%= Url.Action("GetDetails") %>",
......
});
If you stick with the strings and not Url.Action
, put a forward slash before 'Home'
url: "/Home/GetDetails"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With