#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2011
    Posts
    11
    Rep Power
    0

    Php and javascript integration


    Hey all,

    I am a bit of a rookie and am working on a project for myself where I want the user to click on an article, or link, that will submit a query to a MySQL database. Data will be pulled and the page will be updated without a reload of the page. I know that javascript can handle the updating of the page. As I said earlier, I am somewhat a rookie at php. Could you guys help me think through this? I have set up all the php objects for the database by following a tutorial series on Lynda.com. How do I get the data that php pulled from the database to be dynamically updated to the page?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    It's called AJAX. Not to sound lazy but Google around for tutorials on it: there's a lot of them.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2011
    Posts
    11
    Rep Power
    0
    After posting this, I did some more googling around as you suggested. After doing so I came up with another question. Is is possible to do AJAX using single page submission where the PHP code is located at the top of the page? Most of the tuts I found said that a separate file is used that has just the php server side code.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by wizard1399
    After posting this, I did some more googling around as you suggested. After doing so I came up with another question. Is is possible to do AJAX using single page submission where the PHP code is located at the top of the page? Most of the tuts I found said that a separate file is used that has just the php server side code.
    w3schools has a set of ajax primers that will get you up to speed in a couple of minutes. As a new user i can't post link, but you shouldn't have a hard time finding it.
  8. #5
  9. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    Originally Posted by wizard1399
    After posting this, I did some more googling around as you suggested. After doing so I came up with another question. Is is possible to do AJAX using single page submission where the PHP code is located at the top of the page? Most of the tuts I found said that a separate file is used that has just the php server side code.
    Sure. What matters is the code being executed, not where it is. Some people like scattering functionality across multiple files while others like sticking everything in one location.

IMN logo majestic logo threadwatch logo seochat tools logo