I should create a separate ID for each form (for example using the line ID), but I should tell the JS function that every form in this line contains that function Must adhere to:
But it works only on the first click, the second time it opens the PHP script. Hope you can help me, sorry for bad english
First of all:
Instead of making multiple forms with the same ID, There should be many forms with the class only. For id-attribute, the same value should be used only once. Example
& lt; Form id = "elimina_categoria_1" class = "elimina_categoria" & gt; ... & lt; / Form & gt; & Lt; Form id = "elimina_categoria_2" class = "elimina_categoria" & gt; ... & lt; / Form & gt;
Please use more than _1, _2 descriptive naming ... However, if possible.
When each form has the same class, you can call the form by using
$ ('form.elimina_categoria').
Second:
The script you are looking for is something like this.
Function Administratoria () {Var aliminiform = $ (this) .parent () parent () .; // Choose the option of the button $ .post (aluminumform.val ('action')); // Call action defined by the form. Remove the form element from the // page return false; // Do not let the submit button submit the form. } $ (Document) .ready (function () {$ ('.imilana'). Tie ('click', amilantagoria);}); The script may not work in your current situation, but I hope this will help you move forward. You probably add fadein, fadeout effect and you want to see the results of the HTTP POST request before removing the form from the page.
Comments
Post a Comment