I have a table with form elements in it.
for ($a = 0;$a<25;$a++)
{
?>
<tr><td>Number</td>
<td class='ok'><input type='text' name='number[<?php echo $a;?>]' id='number[<?php echo $a;?>]'></td>
<td id='error[<?php echo $a;?>]'></td></tr>
}
i then send this data to jquery for ajax processing, and based on response if i get an error i want to fill the appropriate td (based on $a) with 'fix it'.
success: function(result)
{
//get the value of the $a value in form.
var currentId = $(this).attr('id');
var field1 = currentId.split("[");
field2 = field1[1].split("]");
fieldId = field2[0];
if (result == "error")
{
$(this).removeClass('ok').addClass('error');
var errorId = "error["+fieldId+"]";
$("#"+errorId).html('fix it');
}
I am getting the class to change, so i know the result is "error". my problem is $('#'+errorId) is not being populated with "fix it".