get a bad request 400 on my ajax-admin.php file

I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implemen

I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implement. But I always get a bad request 400 on my ajax-admin.php file. also wp_localize_script used properly with wp_ajax action. when i logged in with Administrator.it works fine. getting 400 with other role.

var file_data = $('#file').prop('files')[0];
            var form_data = new FormData();
            form_data.append('file', file_data);
            form_data.append('action', 'file_upload');

$.ajax({
                url: ajaxurl,
                type: 'POST',
                processData: false,
                data: form_data,
                dataType: "html",
                contentType: "application/json",
                success: function (response) {
                    alert(response);

                },
                error: function(e) {
                    console.log(e);
                },
            });

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745259588a4619148.html

相关推荐

  • get a bad request 400 on my ajax-admin.php file

    I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implemen

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信