Sign in to follow this  
mangeshlad86

Cancel ajax request of chart

Recommended Posts

Hi,

 

I have page with multiple charts on it. On some date change trigger they all get refreshed.

I am using 

myChart.setXMLUrl(chartDataUrl); 

to get chart data in xml format.

 

I want cancel previous incomplete ajax request when new one is made. I have tried using

$.ajaxSetup({
        beforeSend: function(jqXHR) {
            console.log('adding xhr');
            $.xhrPool.push(jqXHR);
        },       
        complete: function(jqXHR) {
            var index = $.xhrPool.indexOf(jqXHR);
            if (index > -1) {
                console.log('deleting xhr');
                $.xhrPool.splice(index, 1);
            }
        },
        global:true
    })

and aborting all ajax calls in next date change.

The problem is that I am not able to get fusion charts ajax request in my $.xhrPool requests array.

 

 

Is there any other way to cancel in progress ajax request.

 

 

Thanks 

 

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for your reply.

I have checked that link. I have already used the method mentioned there for other ajax calls (other than FC).

But for fusion charts,  I am not using $.ajax for getting chart data,

I am using

myChart.setXMLUrl(chartDataUrl); 

So I am not able to capture ajax calls sent through Fusion Chart. Is there any other way like API function of fusion chart ?

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Instead of using "setXMLUrl()" you could make use of "setXMLData()" FusionCharts JavaScript function, and use $.ajax (external to FusionCharts API) to get the chart data as XML string and pass it to the "setXMLData()" function.

 

Hope this helps!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this