We help IT Professionals succeed at work.
Get Started

How to use ajax in jquery to retrieve information from a database?

FairyBusiness
on
560 Views
Last Modified: 2012-05-11
Hi, I would like to retrieve information from my database using ajax in jquery.  I googled this but I have not found a tutorial for exactly what I am trying to do.  (also, many of them had asp.net or C# in them, which I am not familiar with yet)

I know how I would normally retrieve info from the database with php:  (example)

      $query = "SELECT name FROM submenus WHERE id=" . $id;
      $result = mysql_query($query, $conn);
      confirm_query($result);
    while ($row = mysql_fetch_assoc($result)){
                        $name = $row['name'];
    }

but if you want this to change each time according to an item being clicked the page would have to reload.  I would like to display information (details) next to an image (according to the image that is clicked) without the page reloading.

Can anyone tell me a real SIMPLE way of retrieving data from a database or know of a good tutorial for this (jquery/ajax/php)?
Comment
Watch Question
Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 2 Answers and 57 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE