elliott.david 2016-05-28 04:00 采纳率: 25%
浏览 32

为什么我的浏览器要等待?

The first, thank you for see this my post, I use AJAX to send request to server PHP (laravel) and the server will handle request (about 10sec) before return it for AJAX. But, when AJAX request waiting, I open other browser to access my webpage -> It still wait for 10s. I don't understand??? My js

function pullRequest() {
  /* send request to server */
  var xhr = $.ajax({
    method: 'POST',
    url: 'pull?random_key='+Math.floor(Math.random()*10),
    data: {'_token':$('meta[name=csrf-token]').attr('content')},
    success: function(response) {
      /* pull request */
      pullRequest();
    },
  }); /* end ajax */
  $('a[href]').click(function() {
    xhr.abort();
  });
} /* end function pullRequest */

$(function() {
  // pullRequest();
  setTimeout('pullRequest()', 2000);
});

My php

public function handle(Request $request) {
  $time = time()+50;
  while(1) {
    echo connection_status();
    if($this->hasNewMessages() || time() >= $time) {
      break;
    }
    continue;
  }
  return $this->messages;
}

I have record a video about it. I am sorry, cause I don't know insert it. Please, follow link youtube: https://www.youtube.com/watch?v=8jqPU3R-60I

Thank you for reading

</div>
  • 写回答

1条回答 默认 最新

  • 胖鸭 2016-05-28 06:05
    关注

    With the command php artisan serve, you are actually starting PHP's builtin web server.

    As noted in the PHP manual:

    Warning

    This web server was designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.

    If you want a production grade installation or any additional features, you need to use a separate web server such as Apache (which you mistakenly though you were using).

    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程