javascript - jQuery Load() not loading within div -


i trying use jquery open href inside div, rather linking new page. have viewed number of tutorials load() function not seem working me.

please take @ code , let me know piece of puzzle missing.

here html page:

<!doctype html> <html> <head>     <meta charset="utf-8" />     <title>jquery</title> </head> <body> <!-- nav links open in div#content area --> <a class="menu_top" href="pages/home.php">home</a> | <a class="menu_top" href="pages/about.php">about</a> | <a class="menu_top" href="pages/contact.php">contact</a>  <!-- div links open in --> <div id="content-area"></div>  <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <script type="text/javascript" src="js/nav.js"></script> </body> 

and jquery javascript:

$('.menu_top').click(function() { var href=$(this).attr('href'); alert (href); $('#content_area').load(href); //return false;  }); 

i added alert make sure url being retrieved, , is, load new page. added "return false" , did nothing after alert suggesting load() not working.

initially running through wamp tried running page directly folder , browser tried download linked pages instead of opening them. tried uploading remote web site , got same result on wamp.

try:

$('.menu_top').click(function() {     var href=$(this).attr('href');     alert (href);     $('#content-area').load(href);     //return false; }); 

because div called #content-area, not #content_area.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -