Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

ajax call request headers

By: a guest on Apr 13th, 2012  |  syntax: None  |  size: 0.53 KB  |  views: 93  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 var jqXHR = $.ajax({
  2.                         url: serverLink+action,
  3.                         type: "POST",
  4.                         data: "access_token="+accessToken+"&uid="+uid,
  5.                         crossDomain: true,
  6.                         success: function(resp, status, jqXHR){
  7.                                 var header = jqXHR.getAllResponseHeaders();
  8.                                 var match = header.match(/(Set-Cookie|set-cookie): (.+?);/);
  9.                                 if (match) session = match[2];
  10.                                 console.log(jqXHR, header, session)
  11.                         },
  12.                         error: function (jqXHR, status, error) {
  13.                                 console.log(jqXHR.getAllResponseHeaders());
  14.                         }
  15.                 })
  16.                 console.log(jqXHR.getAllResponseHeaders())
clone this paste RAW Paste Data