web - How to fetch data from database after 2 seconds on a jsp page -
currently i'm working on college web project. application/web page sports application/web page, wanted fetch fresh score database or external api after every 2 seconds on jsp
page please provide me solution in not have refresh page (if possible) , fetch latest score.
i'm not getting do. please me out.
try
function getscore(){ $.ajax( { url: "/yoururl/score.jsp", type:'post', data: "input data", contenttype: "application/json", //here specify content type success: function(result){ alert(result); // here result response return score.jsp }) }, error: function(e) { alert("error in getting score!"); } }); settimeout(getscore, 2000); }
here
settimeout(getscore, 2000);
'settimeout' java script method call getscore method on every 2000 m seconds. in getscore call ajax method request data on particular servlet or jsp , data in response.
Comments
Post a Comment