tags:

views:

391

answers:

3

I am using jQuery UI on the front end. I want to get the values off MySQL database on my page on a mouseclick using AJAX.

How do I retrieve data from MySQL using jQuery and update my div with the new HTML without a page refresh?

Thanks

A: 

In Jquery there's a very helpful $ajax function using which you can send Get/Post requests to any webpage and use the retrieved information (which can be HTML) in your page.

Just give $ajax a look and your problem is solved. Though I don't hail from the PHP worls so I can't give you the exact code. Google it.

Cyril Gupta
+1  A: 

I believe you will need a server side controller or script to do the actual MySQL query. See this thread.

Sean A.O. Harney
+2  A: 

You have to provide a service tier, which can be something like a PHP or ASP.net page that gets the $.ajax request from jQuery and executes a query against MySQL backend, then it will recieve the result from the DB,translate it back to something understandable from javascript side, (such as JSON)

bashmohandes