首页 > 解决方案 > ajax jquery中的标题

问题描述

为什么我们在 ajax 中设置标头。ajax 中标头的用途是什么。我不知道标头是做什么的。当我分析代码时会出现一点混乱。只需告诉标头做什么或我们使用的原因。

$.ajax({
            type:       "GET",
            cache:      false,
            url:        $(this).data("url")+'?param='+status,
            dataType:   "json",
            headers:    { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
            success: function(res) {
                if (res.flag == true) {
                    toastr["success"](res.msg, "Completed!");
                    if(res.action == 'reload') {
                        window.location.reload();
                    }else{
                        $("." + remvove).remove();
                    }
                }
            }
        });

标签: jquerycssajax

解决方案


推荐阅读