After your AJAX call to kick off your process, you could make another AJAX call in a loop which requests, returns, and presents the current percentage complete until it reaches 100%. Basically, one AJAX call to initiate the process and then a series of calls which check status.
Update: Here is some simple JavaScript to achieve what you want:
<script>
function startProcess() {
//start your long-running process
$.ajax(
{
type: 'GET',
url: "/longRunningProcess",
async: true,
success:
function (data) {
//do something - your long process is finished
}
});
}
function getStatus() {
//check your progress
$.ajax(
{
type: 'GET',
url: "/checkProgress",
async: true,
success:
function (data) {
//assume the data returned in the percentage complete
var percentage = parseInt(data);
//write your status somewhere, like a jQuery progress bar?
if (percentage < 100) {
//if not complete, check again
getStatus();
}
}
});
}