Laravel:有效负载无效

时间:2018-09-29 19:48:27

标签: ajax laravel

如何解决此错误-

  

有效负载无效。   C:.. \ vendor \ laravel \ framework \ src \ Illuminate \ Encryption \ Encrypter.php#191

我在发送ajax发布请求时得到了它。

<input name="telephone" type="tel" value="" id="phone-number">
<button class="button" type="submit" id='sendSMS' onclick="clickFunction(event, this);">Send SMS</button>

这是我的JS代码-

(function() {
    $('#add-announcement').on('click', '#sendSMS', function() {
        $.ajaxSetup({
            headers: {
                'X-XSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
            },
        });

        $.ajax({
            type: 'POST',
            url: window.url,
            dataType: 'JSON',
            success: function(data) {
                // alert(data);
            },
            error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
                console.log(
                    'AJAX error: ' + textStatus + ' : ' + errorThrown);
            },
        });

        return false;
    });
})();

1 个答案:

答案 0 :(得分:0)

问题已解决,问题出在axaj查询中,查询不正确。

相关问题