---
title: "Will jQuery ajaxStop() make recursive calls ? if so, how to stop it?"  
description: "Will jQuery ajaxStop() make recursive calls ? if so, how to stop it?"  
author: "Anonymous User"  
published: 2013-05-18  
updated: 2013-05-18  
canonical: https://www.mindstick.com/forum/911/will-jquery-ajaxstop-make-recursive-calls-if-so-how-to-stop-it  
category: "ajax"  
tags: ["ajax"]  
reading_time: 1 minute  

---

# Will jQuery ajaxStop() make recursive calls ? if so, how to stop it?

Hi Everyone!\
I'm showing Ajax [login form](https://www.mindstick.com/forum/355/login-form-and-registration-form-in-php) for various user [action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types) in my [portal](https://www.mindstick.com/articles/13008/how-does-a-customer-portal-enhance-the-experience-of-customers), once successfully login I want to [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) some div's for that I'm using following code,\
$([document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool)).ajaxStop([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)(){\
$.get($([location](https://www.mindstick.com/blog/11636/relocating-business-or-office-to-another-location)).attr('href'),function(html){ var $html = $(html); $('#topBar').html($html.find('#topBar')); $('#commentsForm').html($html.find('#commentsForm')); }); });Will above code leads to any recursive Ajax calls ? currently its working as expected but I want to know it clearly.\
Update:\
I kept log at end of the ajaxStop then it [printing](https://www.mindstick.com/blog/63804/5-ways-you-can-use-printing-in-your-marketing-strategy) log [message](https://www.mindstick.com/forum/12802/show-confirmation-message-yes-or-no-in-asp-dot-net) recursively then it shows clearly that above code [making recursive](https://www.mindstick.com/forum/156808/write-a-program-for-making-recursive-function-in-any-language) calls.\

## Replies

### Reply by AVADHESH PATEL

Hi Ankita!\
I think this will cause recursion. After all the other AJAX calls complete, this handler will call. It will start a new AJAX call with $.get(), and when that completes it will trigger the handler, which will call $.get(), and so on.\
To prevent this, you can do:\
$.ajaxSetup( { global: false } );to prevent global AJAX handlers from running. Or replace $.get() with the equivalent $.ajax() call, and use global: false in its options argument.\


---

Original Source: https://www.mindstick.com/forum/911/will-jquery-ajaxstop-make-recursive-calls-if-so-how-to-stop-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
