jQuery AJAX page loading, DIV specific -


Trying to fetch specific DIV from a page called jQuery loader.

I have this code:

  & lt; Script type = "text / javascript" & gt; $ ('Ul.navigation li a'). Click (function () {$ ('# content-wrap'). FadeOut (500); var targetPage = $ (this) .attr ('href') setTimeout (function () {$ ('# content-wrap' ) Load (Target Page, Function () {$ ('# content-wrap'). FadeIn (500);}}}}); Return;}); & Lt; / Script & gt;   

... and it works - but it calls the whole page instead of a specific area ...

Cheers!

You are trying to load the page piece instead of the whole page If you dig deeper into the documentation, you will see that you just have to change your targetPage variable slightly.

  var targetPage = $ (this) .attr ('href'); TargetPage + = "# content-wrap";   

This will replace the targetPage variable with the http: //site.url # content-wrap and instead of the full page Get the content of the # content-wrap element

  • See the Loading page sections section for more.

Comments