Help.
I have a script that is supposed to load data into a div when a link is clicked.
However it's only loading the data when I refresh the page, not when I click the link.
Code:
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function () {
$j.history.init(pageload);
$j('a[href=' + window.location.hash + ']').addClass('selected');
$j('a[rel=ajaxtwo]').click(function () {
var hash = this.href;
hash = hash.replace(/^.*#/, '');
$j.history.load(hash);
$j('a[rel=ajaxtwo]').removeClass('selected');
$j(this).addClass('selected');
$j('#big_slider').hide();
$j('.loading').show();
getPage();
return false;
});
});
function pageload(hash) {
if (hash) getPage();
}
function getPage() {
var data = 'page=' + encodeURIComponent(document.location.hash);
$j.ajax({
url: "slider_loader.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
$j('.loading').hide();
$j('#slider_area').html(html);
$j('#big_slider').fadeIn('slow');
}
});
}
Any help would be greatly appreciated. Thanks.