Manipulate data returned from an AJAX call in jQuery

criminalkaoz

New Member
I have an AJAX call using jQuery:\[code\]$('.add a').click(function() { $.ajax({ type: 'POST', url: '/ajax/fos', context: this, datatype: 'html', success: function(data){ $(this).parents('tr').before(data); } });});\[/code\]Once it runs, it adds a new row to a table. The row is verbatim to other rows in the table (structure-wise), but with no data.I have two other jQuery calls that manipulates the data on the row, but the calls don't work on the new table rows using the AJAX call. Specifically, when a drop-down (select/option) list changes, it does an AJAX call to replace the contents of another drop-down list. Another function removes the row if you want to delete it.These are the functions that are not working:\[code\]$('.fos').change(function() { $.ajax({ type: 'POST', url: '/ajax/courses', context: this, data:({ fos_id: $(this).val(), name: $(this).find(':selected').text() }), success: function(data){ $(this).next().html(data); } });});$('td.remove a').click(function() { $(this).parents('tr').remove();});\[/code\]Does this have something to do with the AJAX call not registering the new row with DOM or can this not be done?
 
Back
Top