Dhaval Dhaval - 12 days ago 5
jQuery Question

jquery function not working on click event

This is my jquery function and it does not work,

$(document).on('click',"#btn_submit",function(){
$('.task_members_'+$(this).parent().parent().find('.j').val()).val(selectedImgsArr);
var select_status = ("#label_task").val();
var j = $(".j").attr('value');
var url = "<?php echo $this->Url->build(array('controller' => 'dashboards','action'=>'addarraysessionproject'))?>";

$.ajax({
type: "POST",
url: url,
async : false,
data: {
array_user : selectedImgsArr,
array_status : custom_array,
select_status : select_status,
'j': j
},
success:function(data){
}
});
$('.close').click();
});


Please let me know where i'm going wrong.

Answer

try this,i think its mistake on line var select_status

$(document).on('click',"#btn_submit",function(){
        $('.task_members_'+$(this).parent().parent().find('.j').val()).val(selectedImgsArr);
      var select_status = $("#label_task").val();
      var j = $(".j").attr('value');
      var url = "<?php echo $this->Url->build(array('controller' => 'dashboards','action'=>'addarraysessionproject'))?>";

         $.ajax({
          type: "POST",
          url: url,
          async : false,
          data: {
                  array_user : selectedImgsArr,
                  array_status : custom_array,
                  select_status : select_status,
                  'j': j
                },
          success:function(data){
          }
      });
        $('.close').click();
    });