Reputation: 103
$(document).ready(function () {
getDefaultPDF();
loadPDF();
});
function loadPDF() {
$('#reportsDiv').load("/Review/DisplayPdfPartial");
}
Our site is hosted under the Default website, within a folder. So the url should be http://servername/foldername/Review/DisplayPdfPartial
but the following code tries to fetch http://servername/Review/DisplayPdfPartial - doesn't add the foldername and fails obviously.
This doesn't happen on local, only when deployed under default website.
What am I missing?
Upvotes: 0
Views: 140
Reputation: 15923
You can use ResolveClientUrl
A fully qualified URL to the specified resource suitable for use on the browser.
Use the ResolveClientUrl method to return a URL string suitable for use by the client to access resources on the Web server, such as image files, links to additional pages, and so on
.
Upvotes: 1
Reputation: 18873
As you have mentioned you are using Asp.Net MVC then in that case instead of specifying url's this way, a more efficient way is to use @Url.Action()
helper method as shown :-
$(document).ready(function () {
getDefaultPDF();
loadPDF();
});
function loadPDF() {
//$('#reportsDiv').load("/Review/DisplayPdfPartial");
$('#reportsDiv').load('@Url.Action("DisplayPdfPartial","Review")');
}
Upvotes: 2