简体   繁体   English

Laravel / PHP中对ajax调用的异步响应

[英]Asynchronous Response to an ajax call in Laravel/PHP

When performing a heavy duty task, like removing all data from a database by tables or similar, is it possible to return a partial response of an ajax request to indicate current status of the task? 当执行繁重的任务时,例如通过表或类似方法从数据库中删除所有数据,是否可以返回ajax请求的部分响应以指示任务的当前状态?

For example if I had 5 tables in a database and run queries to delete data from those tables one by one, is it possible to send a status message after deleting data from each table by json or some other way? 例如,如果我在数据库中有5个表,并运行查询以逐个删除这些表中的数据,那么在通过json或其他方法从每个表中删除数据后,是否可以发送状态消息?

服务器无法响应您的partial响应,至少您正在使用套接字或类似的情况(因为正在使用ajax)不是这样。

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

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