Repeat jQuery ajax call -


how repeat jquery ajax call every 10 seconds?

$(document).ready(function() {     $.ajax({             type: "get",             url: "newstitle.php",            data: "user=success",             success: function(msg) {             $(msg).appendto("#edix");             }       }); 

i've tried wrap $.ajax function , call function setinterval

$(document).ready(function() {     function ajaxd() {          $.ajax({             type: "get",             url: "newstitle.php",             data: "user=success",             success: function(msg) {                 $(msg).appendto("#edix");             }         });     }     setinterval("ajaxd()",10000); }); 

but says "ajaxd not defined"

your method should not placed inside ready method, or only be available there , not outside.

$(document).ready(function() {     setinterval("ajaxd()",10000); });  function ajaxd() {    $.ajax({    type: "get",    url: "newstitles.php",    data: "user=success",    success: function(msg){      $(msg).appendto("#edix");    }  }); } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -