maximum call stack size jquery version 1.9.0
<p>my question involves bad written code, it works but its messy, anyways, it's just for experimental purposes, i was trying to implement a "like system", a user clicks on a button, the object id associated with the button is sent to a script via ajax and a mysql table is updated with the user's like data-which would be the object id. To do this, i had to use php to echo out the object, and a like button with a javascript function attached to it like this:</p>

<pre><code>for($i=0;$i&lt;count($tempest);$i++)

{echo "&lt;div class='posts'&gt;
\"".$row2['screen_name']."\" 
&lt;img src=\"".$row2['avatar']."\" width=50 height=50/&gt;&lt;br&gt;
 added a new page to the magic title
  \"".$row3['magic_name']."\"
   &lt;br&gt;
&lt;img src=\"".$row1['p_name']."\"&gt;
&lt;div id=\"".$i."\"&gt;
&lt;a href='Javascript:penda(\"".$wholei."\",\"".$i."\")'&gt; //this is the javascript function
&lt;img name='mpe' src='images/like_outline.png'&gt; //this is the like button
&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;";
}
</code></pre>

<p>i know echoing out html is w=just wrong, but like i said, it's just for fun, when using jquery version 1.8.3 to do the ajax request here it is:</p>

<pre><code>function penda(item, itid) {
    itid = itid + "";

    $.ajax({
        type: "POST",
        url: "kumbatian.php",
        data: {
            penzi: item
        },
        success: function (ful) {
            if (ful == 'win') document.getElementById('win').innerHTML += "YOU WIN!!";
        }
    });
    document.getElementById(itid).innerHTML = "&lt;a href='unlike()'&gt;&lt;img src='images/like.png' /&gt;&lt;/a&gt;";
}
</code></pre>

<p>i would get the following error, i'm using chrome: Uncaught RangeError: Maximum call stack size exceeded, what i think it meant was that the number of 'likes' being echoed were to many to be attached to the function penda, the size of array $tempest is 6, so there are six like buttons. When i upgraded to jquery version 1.9.0, there was no such error and everything worked fine, so this is my question:
1.) How many buttons would need to be echoed in the format above for the same error to occur in version 1.9.0?
2.)What better way to attach all those like buttons to the function penda() is there to avoid the error i experienced?</p>

<p>EDIT:
as per requested, here's the html output:</p>

<pre><code>&lt;div id="0"&gt;&lt;a href="Javasctipt:penda("mna4","0")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;

  &lt;div id="1"&gt;&lt;a href="Javasctipt:penda("mna4","1")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;

  &lt;div id="2"&gt;&lt;a href="Javasctipt:penda("mna4","2")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;

  &lt;div id="4"&gt;&lt;a href="Javasctipt:penda("mna4","4")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;

  &lt;div id="5"&gt;&lt;a href="Javasctipt:penda("mna4","5")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;

  &lt;div id="6"&gt;&lt;a href="Javasctipt:penda("mna4","6")"&gt; &lt;img name="mpe" src="images/like_outline.png"&gt; &lt;/a&gt;&lt;/div&gt;
</code></pre>

<p>that's it.</p>
