[SOLVED] AJAX with ESPBasic (not need to refresh the page)
Posted: Tue Dec 15, 2015 10:43 pm
Hello, Good News! I love Basic
first load index.htm and stable picture on file manager, then running basic code then
write browser "yourlocalip/file?file=index.htm" and bingo!
complate project link
http://www.newmaan.com/Load_File_Manager.rar
Basic Run
index.htm
first load index.htm and stable picture on file manager, then running basic code then
write browser "yourlocalip/file?file=index.htm" and bingo!
complate project link
http://www.newmaan.com/Load_File_Manager.rar
Basic Run
Code: Select all
var = 0
msgbranch [datayolla]
cls
print "Bir data girin = "
wait
[datayolla]
var = var + 1
msgget "data_kod" gelendata
print gelendata
let myReturnMsg = "geriyollanan kod = " & var
msgreturn myReturnMsg
wait
index.htm
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0041)http://192.168.43.90/file?file=index.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="./index_files/sitil.css" rel="stylesheet" type="text/css">
<title>Ajax Refresh Uygulaması</title>
<script type="text/javascript">
var istek =false;
if (window.XMLHttpRequest)
{
istek = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
istek = new ActiveXObject("Microsoft.XMLHTTP");
}
setInterval(function(){
istek.open("GET", "/msg?data_kod=Tayfun", true);
istek.onreadystatechange = verileriAl;
istek.send(null);
}, 500);
function verileriAl() {
if (istek.readyState == 4 && istek.status == 200)
{
var cevap = istek.responseText;
document.getElementById("sonuc").innerHTML = cevap;
document.getElementById("sonuc").style.backgroundColor="#FF0061";
}
}
</script>
</head>
<body><div align="center">
<div id="cerceve">
<div align="left">
<h1>Ajax Refresh</h1>
<img src="/file?file=not_reload_my_image.JPG" alt="Mountain View" style="width:304px;height:228px;">
<div id="sonuc" style="background-color: rgb(255, 0, 97);">geriyollanan kod = 19.00</div>
</div>
</div>
</div>
</body></html>