ajax value transfer can only transfer the last value of the data, or it is a loop. The loop problem is solved and only the last value can be passed.
z is the post ID set by me
ajax value transfer can only transfer the last value of the data, or it is a loop. The loop problem is solved and only the last value can be passed.
z is the post ID set by me
When the click callback is executed, the loop has finished running, z must be allTopic.length+1, you can use something like
<code>for(var i=0;i<length;i++){ $('test').click(function(i){ return function(){ $.ajax()//use i } }(i)) } </code>
Solution
Why don’t you just concatenate the ID you want to pass into a string or process it into an array, and pass the value in one go? It consumes too much to request the server every time!