...

View Full Version : jQuery + history plugin



Brojo
02-01-2011, 04:32 PM
I'm trying to get jQuery plugin to work with my Ajax script, but it's not working.

I have no idea how to apply it to my code.

This is my core.js :


$j(function(){



$j('a[rel != "noAJAX"]').live('click', function(event){



if ($j(this).attr('name') != ""){



var currentDiv = $j(this).attr('name');



}else{



var currentDiv = divID;



}



$j(currentDiv).html(loadingHTML);



$j(currentDiv).load($j(this).attr('href'));



event.preventDefault();



});



$j('form[rel != "noAJAX"]').live('submit', function(event){



if ($j(this).attr('name') != ""){



var currentDiv = $j(this).attr('name');



}else{



var currentDiv = divID;



}



$j(currentDiv).html(loadingHTML);



$j.post($j(this).attr('action'), $j(this).serialize(), function(html){



$j(currentDiv).html(html);



});



return false;



});



});



I'm trying to add this to the file, but i'm not sure where to put it so it works correctly with my script.



jQuery(document).ready(function($) {
function load(num) {
$('#content').load(num +".html");
}

$.history.init(function(url) {
load(url == "" ? "1" : url);
});

$('#ajax-links a').live('click', function(e) {
var url = $(this).attr('href');
url = url.replace(/^.*#/, '');
$.history.load(url);
return false;
});
});



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum