mercredi 30 septembre 2015

Laravel 5.1 - AJAX POST is not working

I want to have a AJAX post request. So, what I have one is like it-

$(document).ready(function()
{
    var baseURL = $('meta[name=base_url]').attr("content")+'/';
    var lastClicked = 0;
    var token = $('meta[name=csrf_token]').attr("content");

    $( "#button_yes,#button_no" ).click(function()
    {
        var now = new Date();
        if(now - lastClicked > 10000)
        {
            lastClicked = now;
            console.log('Done');
            $.ajax(
            {
                headers: { 'X-CSRF-TOKEN': token},
                url: baseURL+"add_votes",
                success: function(result)
                {
                    alert(result);
                    console.log(result);
                    console.log(token);
                },
                method: "POST",
                data:
                {
                    _token:         token,
                    uuid : $('meta[name=webniar_ID]').attr("content")
                },
            });
        }
    });
});

So, more specifically-

            $.ajax(
            {
                headers: { 'X-CSRF-TOKEN': token},
                url: baseURL+"add_votes",
                success: function(result)
                {
                    alert(result);
                    console.log(result);
                    console.log(token);
                },
                method: "POST",
                data:
                {
                    _token:         token,
                    uuid : $('meta[name=webniar_ID]').attr("content")
                },
            });

But I am getting a 407 Error

enter image description here

enter image description here

Can anyonehelp me please?



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

Aucun commentaire:

Enregistrer un commentaire