Javascript function...late me know

Started on the old forum in September 2012 · view the original in the archive · old links redirect here

5 replies · 482 views · started 14 years ago · 1 min read

4 participants
sanju Developer · 59 posts #1

friends, plz post how to get a randam text from database by javascript. Whats the function to call?

something else Fellow · 2,296 posts #5

Javascript is client side scripting - meaning that all scripts are run on your browser and not on the server

you can use XMLHttpRequest to to get data:

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://somesite.con", false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(null);
var respon = xmlhttp.responseText;
alert(respon);

but you will still need php/mysql to handle your database query or some other scripting language

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close