Please help me! I want to set it to me javascript writes and reads data from the mySql! In real time! 4 lavalair shoutbox! Thanks in advance!
Java script and mySql
Collapse
X
-
i think you'll find it easier to use ajax... otherwise i don't think it's doable cause javascript runs client side n db is server side, so you'd need some kinda refresh i think, like you could do it as a j2me application, but not on a mobile site to my knowledge... I've asked around about similar stuff n a mate was explaining how to link javascript with database the other day, it's all hidden fields n posting n stuff...
-
ok well i found this code on another site..
here if you wanna read whole topic...
<html>
<body>
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('ReloadThis').innerHTML=xm lHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.open("GET","http://www.example.com/the_page_that_contains_the_div_content",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',10000);
}
</script>
<div id="ReloadThis">Default text</div>
</body>
</html>
that should work... they posted something about not on ie, but apparently it works in mozilla chrome, opera, etc...
Added after 5 minutes:
but that's a mixture of ajax n javascript... won't work on most mobiles, maybe on smartphones with all the newfangled technology...
(note to whoever: ok, according to your auto spell check, or is it my browsers? I'm using chrome btw, javascript is a spelling mistake but newfangled isn't... go figure!)Last edited by pmbguy; 09.11.10, 23:16.
Comment
Comment