mercredi 2 octobre 2019

"How to fix 'Ajax request doing a get instead of patch' error after function"

I am making a game that requires credits on the account of which it is played on. I want to make sure that after every play the credits of the user gets updated trough an ajax request, however with this ajax request, I get the same error which is The GET method is not supported for this route. Supported methods: PATCH.

I already tried to change the methods of the ajax request and it is working on other pages.

The ajax request that I made is as following:

$(oMain).on("save_score", function(evt,iMoney) {
    if(getParamValue('ctl-arcade') === "true"){
        parent.__ctlArcadeSaveScore({score:iMoney});
    }
    //...ADD YOUR CODE HERE EVENTUALLY
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    $.ajax({
        url: 'updateBalance/'+,
        type: 'PATCH',
        data: {iMoney:iMoney, _method: "PATCH"},
        success: function(res) {
        }
    });
});

I expected that it would update the users credits, instead got the error: "The GET method is not supported for this route. Supported methods: PATCH."



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire