Question

I want download big data from database so using ajax call single function who pass limit to download database,

ex-66000 records can I pass to ajax function values 20000,20000,26000 this way and download database.

thank you

Was it helpful?

Solution

Well I think, you can use nested AJAX type structure.

Call the second function when the first function accomplish its AJAX call.

Something Like this:

$.ajax({
type: 'GET',
url: "/dosomething",
cache: false,
dataType: "html",
data: { lowerbound:"0"; uperbound: "2000"} ,
success: function(html_input)
{
    $.ajax({
        type: 'GET',
        url: "/dosomething",
        cache: false,
        dataType: "html",
        data: { lowerbound:"2001"; uperbound: "4000"} ,
        success: function(html_input){
        alert(html_input);
        }
    });                                                                       
}
});

I used for 2 iterations.

Another way is that you can pass the variables recursively to the function and perform the desired task. This will help you to scale the functions with n numbers of time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top