javascript - Load code from .php file every few seconds -


I am trying to load code from sadrzaj.php every 3 seconds. This is my code:

  & lt; Body onload = "ima_sta_novo ()" & gt; & Lt; Div id = "sadrzaj" & gt; & Lt; / Body & gt; & Lt; Script type = "text / javascript" & gt; Function ima_sta_novo () {$ ('# sadrzaj') load ('sadrzaj.php'); } SetInterval (function () {ima_sta_novo ()}, 3000); & Lt; / Script & gt;   

But, it is not loading anything. What am I doing wrong?

Solve! I suddenly forgot to include jQuery I'm upset now! : D

Try it out and look at the developer JavaScript console (press in F12) Chrome / Chromium) and see if the word is "applicable" or an error message:

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "http://code.jquery.com/jquery-1.11.0.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "sadrzaj" & gt; & Lt; / Div & gt; & Lt; Script & gt; Function set timer () {setInterval (function () {console.log ('invoked'); $ ('# sadrzaj') load ('sadrzaj.php');}, 3000); } $ (Document) .ready (setTimer); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -