javascript - Repeat the function for every 1 min? -
i calling function parameters onclick method want want function repeat every 1 min here html code: calling function on everyclick parameter id id fetches the lat longs,and plotted in map ,i have done working except data keep recieving end want , have clicked href want particular id sent , keep recieve data of particular id , when click second first should stopped , start .
<html> </head> <body> <a href="#" onclick="todo(1)"></a> <a href="#" onclick="todo(2)"></a> </body> </html>
javascript:
function todo(id) { $.ajax({ type:"get", url: "example?value="+id, datatype:"text", success: function(data) { //parsing; }); }
try this...
use setinterval call function every 1 minute , "trigger" function click automatically when call function "test"
<html> </head> <body> <a href="#" class="todo" onclick="todo(1)">sdsd</a> <a href="#" class="todo" onclick="todo(2)">sdsd</a> </body> </html> function todo(id) { $.ajax({ type:"get", url: "example?value="+id, datatype:"text", success: function(data) { //parsing; }); } function test() { $(".todo").trigger("click"); } var refreshid = setinterval(test, 60000);
Comments
Post a Comment