Long running process with notifications

ASP.NET, CSS, PHP, Tutorials

In a web application, some long running tasks may time out and not finish. To avoid this kind of limitation we will show you how to run such tasks reliably and, at the same time provide progress status to the end user so they know the task is still running. In this article we’ll show you how to achieve this in PHPRunner and ASPRunner.NET.

A common task like this is batch sending email notifications. The key is to initiate a process like this from JavaScript sending the next batch of tasks to the server via AJAX.

1. Button on the List page.

First, we will add a new button to the Customers list page titled ‘Send emails’. The following code goes to ClientBefore event. Leave Server and ClientAfter events empty.


2. List page, BeforeDisplay event.

In this event we simply calculate the number of records in the customers table and pass it to Javascript. This way our Javascript code knows how many emails to send.

Modify the SQL query to match your database structure.



3. After Table Initialized event.

This is where we actually run our job.



Happy coding!

1 thought on “Long running process with notifications

Leave a Reply

Your email address will not be published. Required fields are marked *