Best way to load a page...AJAX
I am new here, and I am reading the docs and getting some online tuts to work on my stuff. I've done a lot of stuff, but I have this simple doubt. Whats the best way to load a page dynamically?
I am trying to do this:
- $('#page2').click(function(){
- $.ajax({
- url:'page2.html',
- success: function(data){
-
- $('.content').html(data);
-
- }
- });
- });
And this:
- $('.menu').click(function(){
-
- var ref = $(this).attr('href');
- $('#content').load(ref).fadeIn('normal');
-
- });
As you can see, I wanna let a default page with links and load pages inside the #content div.
It works, but it blinks or make flashes every click. So, I don't know if there's a better way to "include" the external pages. Sorry if this is much trivial...