javascript - Reloading another PHP into a DIV -
i've read countless articles regarding replacing <div>
other content more php file. cannot seem work. when click either buttons absolutely nothing happens. tried ensure id="xxx" correct , javascript function i'm new javascript. have included code below , links both page attempting put in , test page.
orginal page - http://www.havenswatch.com/records/player.php?playerid=1
test page - http://www.havenswatch.com/records/testdivswap.php
<html> <head> <script> function loadbiopage() { $("#rightpage").load('bio.php'); } function loadcreditspage(){ $("#rightpage").load('creditsmod.php'); } </script> </head> <body> <input type="button" value="bio" onclick="loadbiopage()"/> <input type="button" value="credits" onclick="loadcreditspage()"/> <div id="rightpage"> <?php include('creditsmod.php'); ?> </div> </body> </html>
include jquery , use proper event handlers, if need outputting right data in php scripts, show scripts , ask question :
<html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('#loadbiopage').on('click', function() { $("#rightpage").load('bio.php'); }); $('#loadcreditspage').on('click', function() { $("#rightpage").load('creditsmod.php'); }); }); </script> </head> <body> <input type="button" value="bio" id="loadbiopage"/> <input type="button" value="credits" id="loadcreditspage"/> <div id="rightpage"> <?php include('creditsmod.php'); ?> </div> </body> </html>
Comments
Post a Comment