javascript - Dynamically Load Content -


i want load content using ajax , keeping header being reloaded, similar site.

so far have don't know else add same effect. noticed on website url changes content apart header, want. after looking through source code can't find he's using apart noticing .php extension in url.

$('nav li a').click(function(){   // var pageurl = $(this).attr(href);   var pageurl = $(this).attr('href');    $('#wrap').load(pageurl); }); 

what doing wrong?

update

sorry, did miss out quotes on href although still doesn't work me.

$('nav li a').click(function(e){   var pageurl = $(this).attr('href');    $('#wrap').load(pageurl);    e.preventdefault(); }); 

you need add quotes around attr , stop link changing page adding preventdefault().

edit:

i noticed selector is:

$('nav li a') 

are sure it's not meant #nav or .nav (for id or class)?


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -