I have an Array in PHP which contains data from database. And it prints out also as a table in the same page which has an AJAX delete function.
Trying to explain better
The array contains debt sums related to many people, it is the application’s main function. In the same page, there is a table containing every debt record related to the array, which can be deleted or edited using AJAX.
I have coded the part of deleting the record and removing the TR entry, but it’s not enough: I’d like to change also the debt sum using AJAX which is an PHP Array.
What I have
I have the JS function which removes the TR when the delete button is clicked
// TR Fading when deleted
$('.delete')
.click(function() {
$.ajax({
type: 'GET',
url: 'history/delete/id/'+$(this).attr('id')
});
$(this).parent().parent().fadeOut();
return false;
});
and I have the PHP array (image)
I’d suggest returning the PHP array in JSON format. So the output from your script might look something like:
If you return that with the JSON content type, then many JS libraries (it looks like you’re using jQuery?) will automatically parse that into an object – an array of objects in this case.