jeudi 13 juin 2019

How to show instantly show data after form submit via ajax?

How to show instantly data after form submit via ajax after saving this one. After saving this via my controller function ,how to view saved data into same page without refreshing page:-

<span class=" store_comment_like " data-comment-id=""  >  </span>
  $(document).ready(function() {
$('.post-comment').click(function(e){
          e.preventDefault();
  var commentId = $(this).attr('data-comment-id');
  var data={
    commentId:commentId,
    method:'POST',
    }
  $.ajax(
  {
    url:'/schooldukan/post/comment/'+commentId,
    type: 'POST',
    dataType: "JSON",
    data: data,
  success: function(data) {
  printSuccessMsg(data.success);
$('#commentonpost2')[0].reset();
                  }else{
                    printErrorMsg(data.error);
                  }
              }
  
  });


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire