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 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})}}   

To remove my code here 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;   

So what am I thinking:

  1. If I join in, the JQUF function closes:

    Var index = $ (this) .closest ('tr'). Attr (id);

    That is, if I comment it out, the function will fade the table row.

    1. remove_array_item.php What's wrong with my function because even when I var index And just pass it

      remove_index (1);

      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 var index = $ (this) .closest ('tr'). Attr (id); to var index = $ (this) .clostest ('tr'). Attr ('id'); You forgot the quote around id .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -