javascript - Removing item from session array Jquery Ajax -
I have a line for each element in a table. When the deleted image is clicked, I am trying to extract the element (image of the id is To remove my code here So what am I thinking: That is, if I comment it out, the function will fade the table row. It still does not remove the item from the array and so when the index I refresh the page, the item is back in the table. change deleteRowButton ). At the moment, when you click on the image, nothing happens, however, if I remove the
var index line, then the table row will be faded (but definitely not array elements) Is deleted.
$ (document) .on ('click', '#deleteRowButton', function () {var index = $ (this) .closest ('tr'). Attr (Id); // set index table row ID (numbers in the number corresponding to their position) remove_index (index); $ (this) .clostest ("tr") .FadeOut ('slow'); return back;}) ; Funct Ion remove_index (value) {$ .post (". / / Remove_array_item.php", {index: value})}}
remove_array_item.php The array element:
& lt ;? php included (". / Config / init.php"); includes session_start () etc. $ index = $ _POST [ 'Index']; // index variable $ ca = $ _SESSION ["objColl"]; // Remove ARAR session variable $ ca-> delLineItem ($ index); // Remove array $ $ _SESSION ["objColl"] Enter on = $ Ca; Store Store as Store Variable? & Gt;
Var index = $ (this) .closest ('tr'). Attr (id);
remove_array_item.php What's wrong with my function because even when I
var index And just pass it
remove_index (1);
var index = $ (this) .closest ('tr'). Attr (id); to
var index = $ (this) .clostest ('tr'). Attr ('id'); You forgot the quote around
id .
Comments
Post a Comment