Guest User

Untitled

a guest
Jan 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. function myDatapoll(){
  2.  
  3. $.ajax({
  4.  
  5. type : "GET",
  6. url : '../myData.xhtml',
  7. dataType : "json",
  8. async : true,
  9. cache : false,
  10.  
  11. success: function(data) {
  12. if(data!=null){
  13. if($("span[id='accBal-"+data.pID+"']").length>0){
  14.  
  15. $("span[id='accBal-"+data.pID+"']").text(parseFloat(data.accBal).toFixed(2));
  16. }else{
  17. $("#cash").html('<span id="accBal-'+data.pID+'">'+parseFloat(data.accBal).toFixed(2)+'</span>');
  18. }
  19. }
  20. setTimeout('myDatapoll()',1000);
  21. },
  22. error : function() {
  23.  
  24. }
  25. });
  26. }
  27.  
  28. setInterval('myDatapoll()',1000);
  29.  
  30. function myDatapoll(){
  31. //same as before but remove the setTimeout
  32. }
Add Comment
Please, Sign In to add comment