jQWidgets Forums

jQuery UI Widgets Forums Grid Attach custom headers request

This topic contains 2 replies, has 2 voices, and was last updated by  Martin 3 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Attach custom headers request #120615

    joko.pitoyo
    Participant

    howto attach header request like

    $.ajaxSetup({
    headers: {
    ‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’)
    }
    });

    Attach custom headers request #120617

    joko.pitoyo
    Participant

    Problem solve

    
     var dataAdapter = new $.jqx.dataAdapter(source, {
                    loadServerData: function (serverdata, source, callback) {
                        $.ajax({
                            dataType: 'json',
                            method:'POST',
                            url: "{{route('vehicle.list')}}",
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            },
                            success:function(data){
                               // console.log(data);
                                callback({records:data});
                            }
                        });
                    },
                    //downloadComplete: function (data, status, xhr) { },
                   // loadComplete: function (data) { },
                   // loadError: function (xhr, status, error) { }
                });
    
    Attach custom headers request #120619

    Martin
    Participant

    Hello joko.pitoyo,

    Thank you for the update!

    Best Regards,
    Martin Yotov

    jQWidgets Team
    https://www.jqwidgets.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.