javascript - Input PHP content into a CSS Selector Using Ajax/jQuery -


i'm creating script has needle points various degrees , needs change dynamically. number of degrees needs move located in degrees.php (in page number) trying grab contents of degrees.php , input css selector move needle right direction.

what have far,

below jquery grabs content wind.php has number (139) example , loads div id #windraw. i've got setting interval keep grabbing content page , updating css on fly content changes. loading div id tag and.... part i'm stuck on, getting content #windraw css selector "rotate" (https://github.com/jcubic/jquery.rotate)

jquery:

<script>     $(document).ready(function() {     clearinterval(refreshid);     $("#windraw").load("../raw/wind.php");      });      $(document).ready(function() {     refreshid = setinterval(function() {     $("#windraw").load("../raw/wind.php");     $('#winddirneedle').css('rotate', $"#windraw");     }, 5000);     }); </script> 

i error "uncaught syntaxerror: missing ) after argument list" in console debug however.

html:

<div id="winddircontain"><div id="winddirneedle" style=""></div></div> 

winddircontain circle , winddirneedle needle points right direction.

i'm quite beginner in jquery , know handful of it. please point out whats going wrong code? thanks!

it better use $.get think, rather loading result dom element first. have syntax errors.

$(document).ready(function () {   var refreshid = setinterval(function () {     $.get('../raw/wind.php').done(function (result) {       $('#winddirneedle').css('rotate', result);     });   }, 5000); }); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -