how to display ajax response and close bubble editor form

how to display ajax response and close bubble editor form

jacob.siujacob.siu Posts: 3Questions: 1Answers: 0
edited September 2020 in Free community support
editor = new $.fn.dataTable.Editor( {
        table: "#dataTable",
        idSrc: 'dt_rowid',
         ajax: {
                  url:'xxxx.php'
                  ,data:{ "form": "bom" }
                  ,success: function(response){
                                     alert(response);
                   }               
                  }
});

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Hi,

    I'm not clear on what you want to do here I'm afraid. If you just want to display the JSON returned from the server - use the postSubmit event:

    editor.on('postSubmit', function(e, json) {
      console.log(json);
    });
    

    Allan

  • jacob.siujacob.siu Posts: 3Questions: 1Answers: 0

    I try to create (add) a row.
    In case successful, editor will reload the table and reflect the change. That is good.
    However, I want to display message like 'cannot add for data existed already' in case add is failure. I just don't know how.
    That is my question, thx in advance.

  • jacob.siujacob.siu Posts: 3Questions: 1Answers: 0

    Hi Allan,
    Thanks for your help ... after trying with postSumit event, I believe all I need is adding my 'message' in error object on server side response. The 'message' will display on the form footer as an error ( in red )
    To me case is closed.
    Thx

This discussion has been closed.