Jump to content

Basic Code


Drezard

Recommended Posts

So I have 4 files all up. index.php contains the code that the end-user will see. engine.js contains the code for the AJAX request function. pagea.php and pageb.php contains the code i want it to display. Now, I have written most of the code, I just don't know how to form the basics of the engine.js. WITHOUT all the error correcting and checking if this and that is enabled, what should engine.js look like if when the user clicks the 'pagea' link it displays the php script from pagea.php in it and same except for pageb?

 

Heres what the code looks like:

index.php:

<html>

<head>
    
    	<script src='engine.js' type='text/javascript'> </script>
        
    </head>
    
    <body>
    
    	<div id='main'> </div>
        
        <a href="javascript: AjaxRequest('pagea.php')">PageA</a>
        <a href="javascript: AjaxRequest('pageb.php')">PageB</a>
    
    </body>
    
</html>

 

engine.js:

function AjaxRequest(page) {



}

 

pagea.php

<?php

echo "This is page a";

?>

 

pageb.php

<?php

echo "This is page a";

?>

 

Could you please help?

 

Thanks, Daniel

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.