0
votes

I created an array through getting data from button onclick, and then I want to get this data for future ajax using. At this stage, I only want it to show up in the console:

fixtureArray.push(fixture);
$(fixtureArray).each(function() {
    triggerNumber = $(this).text();
    console.log(triggerNumber);
});

I also have tried this

$.each(fixtureArray, function() {
        triggerNumber = $(this).text();
        console.log(triggerNumber);
    });

But the console keep showing something like this:

Uncaught RangeError: Maximum call stack size exceeded
Sizzle.getText
Sizzle.getText
Sizzle.getText
Sizzle.getText
Sizzle.getText
Sizzle.getText
...

Any idea why this would happen? Thanks!

1
Can you reproduce the problem on jsfiddle.net? - undefined
What is fixture exactly? Give us an example. - epascarello
fixture would just be some numbers like '1', '2', '3' - the_summer_bee
for example: <a onclick="set('1')">...</a>, the above code will be in a function called set(num) {...} - the_summer_bee
It makes no sense to use $(this).text() for a string! - epascarello

1 Answers

1
votes

You should not be using $(this).text() if it is a string, use the passed in arguments

var arr = ["1","2","3"];
$.each(arr, function (ind, value) {
    console.log(value);
});