【问题标题】:list message using ajax refresh使用ajax刷新列出消息
【发布时间】:2015-01-30 13:40:25
【问题描述】:

您好,我想使用上下文 io 列出电子邮件。但有时它会返回零消息并显示空白页。所以我决定使用 ajax。

Step1 :First I take the count of messages
Step2 : Check if count>0
Step 3: if count>0 =>list message
Step 4 : else again take count and repeat step 3 and 4

我的代码是,

 $(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);
  }});

}

但有时它需要超过 30 次刷新,最终得到一个500 internal server error。 我认为这是服务器过载的问题。这是一个正确的逻辑还是任何其他解决方案?请帮助我

【问题讨论】:

    标签: ajax codeigniter refresh contextio


    【解决方案1】:

    如果您在使用其中一个 API 库时没有看到消息,则可能是帐户连接存在问题。对服务器的请求过多会导致电子邮件提供商限制外部服务对帐户的访问。

    如果您仍有问题,请发送电子邮件至 support@context.io。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-26
      • 1970-01-01
      • 1970-01-01
      • 2014-04-23
      • 2020-02-25
      • 1970-01-01
      相关资源
      最近更新 更多