views:

190

answers:

3

i have stored values in mysql and i want to retrive that value in webpage

but the webpage is creted only using javascript

so how can i use that database's value in javascript

A: 

You really need to give more information as to what you want to do, but as you implied that the page isn't dynamic the method would be to use ajax to request a dynamic page (written in a sever side langugage) that retrieves the data from the database and outputs it in the required format.

Yacoby
but tell me specifichow to use ajax over here
Khilen
@Khilen Google has endless tutorials.
Yacoby
i have table called categoryit has CName, COrdernow suppose i have 5 category then i have to generate 5 Buttons using javascript and the caption of these button will be category namenow suggest what i have to do
Khilen
@Khilen if you have additional information it is best being edited into the question.
Yacoby
A: 

You'll need to either...

a) Have a separate, server-side script which can run the appropriate query, and then pass through the data to the page through an AJAX-type call (jQuery et cetera have functions to simplify the AJAX side of things, if you so desire),

OR

b) Put some server-side code into the page that is evaluated before the page is served and writes the data into the page within something that the Javascript can access it from (i.e. the definition of a variable or some such).

Amber
i have table called category it has CName, COrder now suppose i have 5 category then i have to generate 5 Buttons using javascript and the caption of these button will be category name now suggest what i have to do
Khilen
+1  A: 

You need to have a server side script in the middle so you can retrieve the value using ajax.

What you're asking for is only possible with a restful nosql database like CouchDB.

rogeriopvl
i have table called category it has CName, COrder now suppose i have 5 category then i have to generate 5 Buttons using javascript and the caption of these button will be category name now suggest what i have to do...this is just example i have to generate whole page dynamically by selecting database record
Khilen