Laravel 5.1 - AJAX POST - 获取错误407

时间:2015-09-30 11:20:04

标签: jquery ajax laravel laravel-5

我想要一个AJAX帖子请求。所以,我有一个是喜欢它 -

$(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")
                },
            });
        }
    });
});

所以,更具体地说 -

            $.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")
                },
            });

但我得到 407错误

enter image description here

enter image description here

有人可以帮助我吗?

0 个答案:

没有答案