...

View Full Version : Loada php file into a div



tomharto
07-04-2011, 12:50 AM
Is this doable using Javascript? Basically i just need (if there is one) a Javascript version of PHP include ("the/file.php");

sunfighter
07-04-2011, 06:14 AM
Are you trying to show the coding of your php script or are you trying to execute it in the div?

You can treat it as text and write it to the page JUST do not inclose it in the php tags

Use php to open and read the file but remove the tags and write it out like any file.

tomharto
07-04-2011, 06:16 AM
I want it to actually execute the code.

sunfighter
07-04-2011, 04:24 PM
OK. Two answers for you. First No; javascript executes in the computer and php executes on the serve.

or YES; using ajax javascript can send variables to the server and execute a php script. The output from that is sent to the javascript to do with what it wants and outputting to a div is common place.

google 'learn ajax' and get a bunch of sites.

tomharto
07-04-2011, 05:51 PM
I do know very basic AJAX but i never thought of using that, *facepalm* thanks :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum