Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-23-2012, 05:43 PM   PM User | #1
dingod
New to the CF scene

 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dingod is an unknown quantity at this point
Jquery Not loading data properly...

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.
dingod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:50 AM.


Advertisement
Log in to turn off these ads.