1

我将 OData 与 JQuery 一起使用。我的问题是我需要检索 Header 因为我需要 Header 值。你们知道语法吗?

我的代码如下:

      OData.request( {headers: { "X-CSRF-Token" :"Fetch" }, requestUri:queryserviceUriNew, user: uname, password: pword }, 
      function (data, response) 
     { 
        //Success Callback (received data is a Feed): 
   alert("Retrieved.");

   alert(response);
        // This is the object that hold the response, I need to capture the header value for "x-csrf-token"

      }

谢谢各位专家!

4

1 回答 1

1

如果有人在寻找答案,语法是:

var header_value; // 变量 = variable_hold_httpResponse.headers['header_item_that_you_want_to_get']; header_value = response.headers['x-csrf-token'];

干杯!

于 2012-04-26T01:53:47.690 回答