dimanche 30 juillet 2017

Laravel JQuery AJAX POST get data

I have a code:

var bet = {
tournament: '',
    bo: '1',
    bet_team: '2',
    betted: '3',
    potential: '4',
    percent: '5'
};
$.ajax({
            type: 'POST',
            url: '/api/makeBet/',
            data: bet,
            contentType: 'application/json',
            dataType: 'json',
            success: function(data) {
                if(data.error) {
                    sweetAlert("Oops...", data.data, "error");
                } else {
                    sweetAlert("Success!", data.data, "success");
                }
            },
            error: function(html, status) {
                console.log(html.responseText);
                console.log(status);
            }
        });

But when I'm trying to get $request->tournament or something else, I'm getting nothing.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2u9lnSu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire