zurna
zurna

Reputation: 1191

ajax call is looping indefinitely

I am pulling categories from an xml file. I only have 5 categories but the code below keeps pulling categories indifitely! Weird thing, I dont even have a loop in the xml function.

    $.ajax({
        dataType: "xml",
            $(xml).find('row').each(function(){
                var id = $(this).attr('id');
                var CategoryName = $(this).find('CategoryName');
            });

        }
    });

Upvotes: 1

Views: 174

Answers (2)

Dancrumb
Dancrumb

Reputation: 27539

I think the problem is with your use of tabs as opposed to the code that you've highlighted.

What's happening is that some code somewhere is making a GET request to #, which is tantamount to requesting your current page. jQuery then parses the page, processes the scripting contained withing and you get your infinite loop.

Looking at the HTML, I see:

<div class="row-title clear red">
  <div class="tab fleft"><a href="#">Photos</a></div>
  <div class="tab fleft"><a href="#">Videos</a></div>
</div>

I think those are your culprits

Upvotes: 0

kim3er
kim3er

Reputation: 6476

Do you have any JavaScript in the response of your Ajax call? jQuery automatically executes JavaScript and strips it out of the response. If you are receiving code that you have just executed, this will lead to recursion.

Upvotes: 1

Related Questions