custom button -> response in new window

custom button -> response in new window

dmiketadmiketa Posts: 2Questions: 1Answers: 0
edited March 2019 in Free community support

Hi, I'm new to datatables . So far i'm trying to figure as much as i can on my own but now i stuck with one problem. I'm using laravel framework and my idea is to filter datatables and then call custom button which is forwarding json to my controller which is than formatting resulting json data and should ideally load new tab with doompdf generated pdf. (label printing)

this is what i have so far

                        text: 'barcode print',
                          action: function (e, dt, node, config){
                            var ajaxData = dt.rows( { search: 'applied' } ).select().data().toArray();
                            $.ajax({
                                    url: '/inventories/barcodeprint',
                                    type: 'POST',
                                    data: JSON.stringify(ajaxData),
                                    contentType: 'application/json; charset=utf-8',
                                    dataType: 'json',
                                    processData: true,
                                    //async: false,
                                    success: function (response){
                                             $('.buttonResults').html(response.html);
                                            }})
                  },

my controller is accepting json but i cannt figure out how to load new tab. In console i have correct response. Please assist and forgive my bad English. Thanks

Answers

  • dmiketadmiketa Posts: 2Questions: 1Answers: 0

    i did workaround. first button interacts with laravel controller, which generates pdf and save it to server, then i made a second button which is basically url pointing to generated pdf.. i tried to use success:function to open that url after success respond but didn't managed to figure out how. now i have two clicks instead of one. If anybody can help with thar success response i would appreciate.

This discussion has been closed.