jquery ajax using 'addresses' to update url for bookmarking
- by Jay
$("document").ready(function(){
contM = $('#main-content');
contS = $('#second-content');
$(contM).hide();
$(contS).hide();
function loadURL(url) {
console.log("loadURL: " + url);
$.post(url,{post_loader: 1},{post_loader: 1}, function(data){
$(contM).html($(data));
$(contM).show();
});
}
// Event handlers
$.address.init(function(event) {
console.log("init: " + $('[rel=address:' + event.value + ']').attr('href'));
}).change(function(event) {
$.post($('[rel=address:' + event.value + ']').attr('href'), {post_loader: 1}, function(data){
$(contM).html($(data));
$(contM).show();
});
console.log("change");
})
$('.update-main a').click(function(){
loadURL($(this).attr('href'));
});
});
I'm using this code to make calls to a server to update the main content of a web page. Everything works fine in Google Chrome, but fails to execute properly in Firefox.
The strange thing is that when I have the console open to monitor server communication, the application works fine, only when it is closed do problems occur : the script starts to communicate with the server, but before it receives the data the browser jumps to the source url.
any ideas?