jeudi 19 septembre 2019

I want to get value of text fields on check ckeckfield

I want to update personal publications on a text field on check of their corresponding check box which are displayed dynamically, I have a problem when getting the text field value related to the checkbox. I have dynamic text fields, each with a checkbox(dynamic too) related to it. Now what i want to achieve is, if the user checks a checkbox then submits ajax picks corresponding text values only and sends to php

I have tried submitting and i sends all the displayed fields back for update i need it to be more specific to the checked fields only

<form name="up_me" id="up_me" enctype="multipart/form-data" method="post"> <tr> 
  <td class="format main ">
 <p class=" del" >".strip_tags(htmlspecialchars_decode($data, ENT_NOQUOTES))." 
   </p>
  <span class="format del" style="display:none;">
 <textarea rows="8" name="up_name[]">".strip_tags(htmlspecialchars_decode($data, ENT_NOQUOTES))." </textarea>
<input type="text"  value="$Date" id="up_date[]" name="up_date[]" /> <input type="text"  value="$Idd" id="up_id[]" name="up_id[]" class="hidden"/>
  </span>
   </td>;"

AJAX Code

$.ajax({  
        url: "update_action.php",  
        type: "POST",  
        data: $('#up_me').serialize(),

        success:function(response){

        if( response == "pass" )
        {
            swal({
                    title: "Congratulations !",
                    text: " Publication Data Updated Successfully", 
                    icon: "success",
                    button: "Aww yiss!",

                },
                function() {
                    location.reload();
                });
        }
        else
        {
            alert(response);
        }
    }
});




Aucun commentaire:

Enregistrer un commentaire