简体   繁体   English

jQuery ajax和php的异步请求/响应

[英]asynchronous request/response with jquery ajax and php

I have a javascript file that call with $ajax a php script. 我有一个JavaScript文件,用$ ajax调用了一个php脚本。

$.ajax({
    url : "myscript.php",
    success : function (data) {
          doSomething();
    },
    error : function (data) {
                  doSomethingElse();
    }
});

My php script will print more output during the process, one at a time. 我的php脚本将在此过程中一次输出更多输出。

Can I visualize these output asynchronously while the php script is processing? 我可以在处理php脚本时异步可视化这些输出吗?

Or I have to wait the end and show all togheter the output string from php script? 还是我必须等到最后,并向所有togheter显示php脚本的输出字符串?

Thank you. 谢谢。

You cannot retrieve parts of the response until the response is complete. 在响应完成之前,您无法检索响应的一部分。 You will have to implement AJAX requests that provide status information. 您将必须实现提供状态信息的AJAX请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM