codeigniter - list message using ajax refresh -
hi want list emails using context io.but times returns 0 messages , show blank page.so decided using ajax.
step1 :first take count of messages step2 : check if count>0 step 3: if count>0 =>list message step 4 : else again take count , repeat step 3 , 4
my code is,
$(function() { var contid='<?php echo $_get['contextio_token'];?>'; $("#ajaxloader").html('<img src="<?php echo base_url();?>images/ajax-loader.gif" style="width:60px;">'); $.ajax({ type:"post", url:"<?php echo base_url();?>index.php/gmailcontrol/countcontext", data:"contxtid="+contid, success:function(result){ if(result>0) { viewcontextio(); } else { refreshcontext(); } }}); }); function refreshcontext(){ var contid='<?php echo $_get['contextio_token'];?>'; $("#ajaxloader").html('<img src="<?php echo base_url();?>images/ajax-loader.gif" style="width:60px;">'); $.ajax({ type:"post", url:"<?php echo base_url();?>index.php/gmailcontrol/countcontext", data:"contxtid="+contid, success:function(result){//alert(result); if(result>0) {viewcontextio(); } else { settimeout(refreshcontext, 10000); } }}); } function viewcontextio() { var contid='<?php echo $_get['contextio_token'];?>'; $("#ajaxloader").html('<img src="<?php echo base_url();?>images/ajax-loader.gif" style="width:60px;">'); $.ajax({ type:"post", url:"<?php echo base_url();?>index.php/gmailcontrol/view_contextiomsg", data:"contxtid="+contid, success:function(result){//alert(result); $("#ajaxloader").html(''); $("#contextmsgcnt").html(result); }}); }
but times takes more 30 refresh , got 500 internal server error
. think problem of server overloading.is correct logic or other solution?any 1 please me
if you're not seeing messages when using 1 of api libraries there's problem account connection. many requests server can cause email provider throttle access account outside services.
if you're still having problems email @ support@context.io.
Comments
Post a Comment