0

Here is the JSON data I m getting with the click on button, I just want to know how to decode JSON data in JQuery, JSON data I am getting in: data-tag_id : {"data":["abcd","hello"]}

$('.editMasterCommentButton').on('click',function(){
        let data = {};
        data.id = $(this).attr('data-id');
        data.comment = $(this).attr('data-comment');
        data.tag_id = $(this).attr('data-tag_id');
        console.log(data.tag_id);

        data.comment_id = $(this).attr('data-comment_id');

        $('#editMasterCommentModal_id').val(data.id);
        $('#editMasterCommentModal_tag_id').val(data.tag_id);
        $('#editMasterCommentModal_comment_id').val(data.comment_id);
        $('#editMasterCommentModal_comment').val(data.comment);
        $('#editForm').attr('action','{{url('MasterComment')}}/'+data.id);
    });
vikram
  • 1
  • 2
  • 1
    Possible duplicate of [How to parse JSON data with jQuery / JavaScript?](https://stackoverflow.com/questions/8951810/how-to-parse-json-data-with-jquery-javascript) – Richard Feb 21 '19 at 08:01

1 Answers1

0

seems you are looking for $.parseJSON(json_here).

Rohit Mittal
  • 2,064
  • 2
  • 8
  • 18