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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire