birdbrain24 Posted February 5, 2008 Share Posted February 5, 2008 How could i add AJAX to this page so that when the POST methos page is changed it will just get the new include instead of having to reload the page? Also if it can not work how my page is set up i am willing to change my page to make it work! So if anyone could help please do so! Thanks! <html> <head> <title>RACE</title> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript" src="javascript.js"></script> </head> <body> <?php # Common functions! session_start(); include 'functions.php'; connect(); sessioncheck(); lastaction(); ?> <table align="center" cellspacing="5"> <tr> <td align="right" width="175" style='vertical-align: top; padding: 0px;'><?php require_once 'menu.php'; ?></td> <td align="center" style='vertical-align: top; padding: 0px;'><?php if(isset($_GET['page'])): $page = $_GET['page']; $file_to_include = $page . ".php"; if(file_exists($file_to_include)): include($file_to_include); else: header('Location: index2.php?page=news'); endif; else: header('Location: index2.php?page=news'); endif; ?></td> <td align="left" width="175" style='vertical-align: top; padding: 0px;'><?php require_once 'stats.php'; ?></td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 5, 2008 Share Posted February 5, 2008 You need to add your includes and any other code that help the includes function and then add your ajax to another page. You would set your ajax up to query the include php page (that you just created) and your ajax's http.responseText will return your php include's content to your page (that contains the ajax script). My suggestion is for you to read up on some tutorials and examples to see how ajax works with php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.