javascript - HTML communication issue: jQuery .load function doesn't seem working -
i'm working on group project in highschool (so i'm not real developper) , have create website that'll display datas off of web server arduino card created (just html page). looked 8 weeks solution through internet , definetely didn't find anything, have 1 week finish this, i'm desperate..
i have learned html , css, little bit of javascript , jquery. , operations made in local environnement.
first, tried value opening web server in new window -> taking wanted value -> closing window using :
<script> function myfunction() { var mywindow = window.open("http://192.168.137.201/", "", "width=1","height=1"); var x = mywindow.document.getelementbyid("temp").innerhtml; document.getelementbyid("content").innerhtml = x; mywindow.close(); }
so i'm trying output value "temp" id webserver in paragraph "content" value. here how server looks like:
<!doctype html> <html> <head> <meta charset="utf-8"/> </head> <body> <p id="temp">-1</p><br /> <p id="cod">-90</p><br /> <p id="partic">0</p><br /> <p id="anemo">14</p><br /> </body> </html>
replace text in paragraph.
<p id="content">en attente de donnée(waiting data)</p> <button id="btn">mettre à jour(update)</button>
the script working whenever clicked button below paragraph. window opening closing paragraph wasn't changing or became blank.
later discovered jquery , found more useful because changes value without opening window. used .load fonction used on w3schools website still won't work.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn").click(function(){ $("#content").load("http://192.168.137.201/ #temp"); }); }); </script>
i used google cdn in example tried microsoft's 1 , local downloaded one.
as said looked long time , tried different methods, checked if didn't miss code key such ".innerhtml" , others. have xbee modules not working , have find solution issue understand can't spend more time searching.
thanks answers.
Comments
Post a Comment