I've notice that when you make a request using the following http://my_ip/s you get a file with the status of AN4, portD, portA etcetera with the name s.txt so I made the following code to request this file content via Ajax request and even when it works on a real (or traditional) server simulation, it does not work on the wifi demo, can somebody explain why please?
Code developed in ajax:
Code: Select all
const code char *indexPage =
"<HTML><HEAD>\
<script>\
function loadXMLDoc()\
{\
var xmlhttp;\
xmlhttp=new XMLHttpRequest();\
xmlhttp.onreadystatechange=function()\
{\
if (xmlhttp.readyState==4 && xmlhttp.status==200)\
{\
document.getElementById(\"myDiv\").innerHTML=xmlhttp.responseText;\
}\
}\
xmlhttp.open(\"GET\",s,true);\
xmlhttp.send();\
}\
</script>\
</HEAD><BODY>\
<h1>WiFi Mini Web Server</h1>\
<script src=/s></script>\
<table><tr><td valign=top>\
<table border=1 style=\"font-size:20px ;font-family: terminal ;\">\
<tr><th colspan=2>ADC</th></tr>\
<tr><td>AN4</td><td>\
<div id=\"myDiv\"><script>document.write(AN4)</script></div>\
</td></tr></table></td></tr></table><p></p> \
<div id=\"myDiv\"></div>\
<button type=\"button\" onclick=\"loadXMLDoc()\">Press button</button>\
" ;
const code char *indexPage2 = "</BODY></HTML>\
" ;
I know that once I am able to receive the string s.txt I will have to separate the AN4 value from the others but this is pure javascript.