用原生ajax将信息放到请求头中
export function setHeaderRequest(url, options){ const setData = { "data": JSON.stringify({ "pageId" : "test data" }) }; var xhr = $.ajax(url, { data: options.data, type: options.method || 'post', success: options.success || undefined, error: options.error || undefined, beforeSend: options.beforeSend || undefined, complete: options.complete || undefined, headers: setData }); return xhr; }
有的时候,一些信息要通过请求头返回给后端,可以用这种方法