Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts

    Loada php file into a div

    Is this doable using Javascript? Basically i just need (if there is one) a Javascript version of PHP include ("the/file.php");

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,691
    Thanks
    25
    Thanked 656 Times in 655 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    I want it to actually execute the code.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,691
    Thanks
    25
    Thanked 656 Times in 655 Posts
    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.

  • #5
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    I do know very basic AJAX but i never thought of using that, *facepalm* thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •