2

I'm making a script and found an error when I want call again the ajax function by links generated by this.

This is the html

<tr>
  <td>1</td>
  <td>2012-04-11 00:00:00</td>
  <td>2012-04-23 00:00:00</td>
  <td></td>
  <td></td>
  <td></td>
  <td>
  <div id="op_33"><a id='33' name="33" class="elimina" >delete</a></div>
  </td>
</tr>

and several similar rows whit diferents id.

This is my ajax function.

jQuery('.elimina').click( function(event) {
    if (confirm("Pulse aceptar si desea eliminar dicha linea"))
        {         
        event.preventDefault()
        var id = $(this).attr('name');
        jQuery.ajax({
          type: "POST",
          dataType: 'html',
          url: 'process/functions_seguimientos.inc.php',
          data: 'action='+$(this).attr('name'),
          success: function(data) {
            jQuery('#lista_genera').html(data);

          }

        });
}
    });

The script php delete the unegisters the element from sql database by id and generate the list with the same options for delete.

The first time ajax function no have any problem, but when the resulting list I try to click on the link for delete another record, that link no longer works.

Thanks in advance for your prompt assistance

Erick

0

2 Answers 2

1

Not Sure but check your data :

data: "{'action':" + $(this).attr('name') + "}",
Sign up to request clarification or add additional context in comments.

Comments

0

not sure try:

jQuery('.elimina').live("click",function(event) {

or :

jQuery('div').on("click",".elimina",function(event) {

or if you're using old jQuery version:

jQuery('.elimina').bind("click",function(event) {

1 Comment

Thanks for your help, I use the first option and all funcioned

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.