如何停止AJAX查询?

I've taken my first real step into AJAX and I'm using the following call that works fine:

function mapSuppliers(customer_id) {
    $.get("get.map.points.php", { c_id: customer_id },
     function(data){
         if (data!='') {
            openMapWindow(data);
         } else {
             alert("Missing map coordinates - cannot display map");
         }
     });

}

My Question - Using Firebug to monitor the process, it makes the call and returns the values as expected. However, the little loading circle that indicates activity continues to spin long after data is returned.

Do I need to close the connection or stop the call? WHy does the circle keep spinning? enter image description here

     function(data){
         $("#myimage").hide();
         if (data!='') {
            openMapWindow(data);
         } else {
             alert("Missing map coordinates - cannot display map");
         }
     });

Just hide image in callback function.

You should hide the spinning image once ajax call is completed. Alternatively you can use ajaxStart() and ajaxStop() methods that will be used for all ajax requests.

E.g.

$("#imageID").ajaxStart(function(){
   $(this).show();
});

$("#imageID").ajaxStop(function(){
   $(this).hide();
});

Try the following:

  1. Check this behavior in Chrome also to confirm whether this if Firebug issue.
  2. Is this a PHP application and are you using flush or ob_flush?