Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

AJAX Call to Web API fails since JQuery is ignoring Subdirectory in base Url

$
0
0

I have a MVC Web Application with some Web APIs.  In the Views I have implemented the Ajax Call to this Web APIs my problem is when I publish my application in a Subdirectory:

$.ajax({

       url: "/api/ControllerName/Action",

});

I have read that when I use / at the beginning of the url it suppose that JQuery will append the base url of my webapplication that is http://localhost/Subdirectory so the full path of the Ajax call should behttp://localhost/Subdirectory/api/ControllerName/Action the problem is that instead of this JQuery is making the Ajax call with this Urlhttp://localhost/api/ControllerName/Action without the Subdirectory.     

Any idea why the sub-directory is being ignored in the base url?  

Thanks in advance, 

Luis A.


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>