I’m using this code to load pages onclick without reloading the current page:
$(function() {
$("#tabs a").click(function() {
var page = this.hash.substr(1);
$.get(page+".php", function(html) {
$('#content').html(html)
});
return false;
});
});
The code is working and everything’s fine except that it looks for the pages to display within the same path of the current page, for example if the current page is www.mysite.com/index
It looks for www.mysite.com/index/page.php
and this page doesn’t exist because I put my PHP pages in a specific folder
how to change the code to make it look for the external pages in the specific folder that I want?
.get, forms, anchors, etc. will all use relative paths if you give them relative paths. If you want them to use an absolute path, provide an absolute path. Absolute paths begin with a slash/.For example:
This of course requires
pageto be the full path.