久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

jQuery 和 AJAX 響應標頭

jQuery and AJAX response header(jQuery 和 AJAX 響應標頭)
本文介紹了jQuery 和 AJAX 響應標頭的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以我得到了這個 jQuery AJAX 調用,并且響應以 302 重定向的形式來自服務器.我想采用此重定向并將其加載到 iframe 中,但是當我嘗試使用 javascript 警報查看標頭信息時,它顯示為 null,即使 firebug 正確地看到它.

So I've got this jQuery AJAX call, and the response comes from the server in the form of a 302 redirect. I'd like to take this redirect and load it in an iframe, but when I try to view the header info with a javascript alert, it comes up null, even though firebug sees it correctly.

這是代碼,如果有幫助的話:

Here's the code, if it'll help:

$j.ajax({
    type: 'POST',
    url:'url.do',
    data: formData,
    complete: function(resp){
        alert(resp.getAllResponseHeaders());
    }
});

我真的無法訪問服務器端的東西來將 URL 移動到響應正文,我知道這將是最簡單的解決方案,因此任何有關解析標頭的幫助都會很棒.

I don't really have access to the server-side stuff in order to move the URL to the response body, which I know would be the easiest solution, so any help with the parsing of the header would be fantastic.

推薦答案

如果您使用的是舊版本的 jquery,cballou 的解決方案將可以工作.在較新的版本中,您也可以嘗試:

cballou's solution will work if you are using an old version of jquery. In newer versions you can also try:

  $.ajax({
   type: 'POST',
   url:'url.do',
   data: formData,
   success: function(data, textStatus, request){
        alert(request.getResponseHeader('some_header'));
   },
   error: function (request, textStatus, errorThrown) {
        alert(request.getResponseHeader('some_header'));
   }
  });

根據文檔 XMLHttpRequest 對象從 jQuery 1.4 開始可用.

According to docs the XMLHttpRequest object is available as of jQuery 1.4.

這篇關于jQuery 和 AJAX 響應標頭的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當文本框獲得焦點時選擇所有內容)
主站蜘蛛池模板: 亚洲成人网在线观看 | 精品视频一区二区 | 国产精品久久久久久久久久久久午夜片 | 毛片一区二区 | 99久久国产免费 | 精品一区二区在线观看 | 欧美性区| 亚洲国产精品第一区二区 | 黄色av免费网站 | 国产日韩一区二区 | 免费观看一级特黄欧美大片 | 精品视频999 | 午夜激情一区 | 日韩中文av在线 | 蜜桃官网 | 久久一区二区三区四区 | 国产日韩精品视频 | jizjizjiz中国护士18 | 久久人体| 久久精品国产亚洲a | 欧美一级片久久 | 亚洲精品日韩一区二区电影 | 黄免费观看视频 | 亚洲国产高清高潮精品美女 | 精品一区二区三区在线观看 | 日本成人毛片 | 久久r精品 | 日本欧美国产在线观看 | 久久亚洲国产 | 91视频观看| 美女国内精品自产拍在线播放 | 中文字幕一区二区三区四区不卡 | 国产情侣啪啪 | 91麻豆蜜桃一区二区三区 | 狠狠色综合欧美激情 | 精品久 | 亚洲精品欧美一区二区三区 | 一区二区三区亚洲 | 蜜臀久久99精品久久久久野外 | 亚洲国产中文在线 | 一区二区在线免费观看 |