title: How to Use JQuery to Store Session ID from HTTP Response?
body: <p>I am making HTTP requests to a web service that requires authentication.  My intiial request is as follows:</p>
  
  <pre><code>function getReq() {
  $.ajax( {
     type: "GET",
     url: urlRequest,
     dataType: jsonp,
     cache: false,
     // success: getRates,
     error: onFaultAjaxRequest,
     timeout: DEFAULT_TIMEOUT_AJAX_REQUEST
  });
  }
  </code></pre>
  
  <p>The urlRequest contains the base address plus a querystring with my username and password.  The HTTP response resulting in this request includes a session ID.  This session ID is used in subsequent HTTP requests to the web service.</p>
  
  <p>How do I trap the session ID using JQuery or another alternative method?  </p>
  
  <p>When I receive the second response with my currency data, how do I utilize JQuery CSV plugin to create an array from the data returned in CSV format?  </p>
  
  <p>Thanks,
  Sid</p>
  
  <p><strong>Edit</strong> Based on responses thus far, here's what I have written for my js file:</p>
  
  <pre><code>var urlRequest = "http://webrates.truefx.com/rates/connect.html?u=user&amp;p=pass&amp;f=html&amp;q=dfrates"
  var DEFAULT_TIMEOUT_AJAX_REQUEST = 33000; //in milisecond
  var DEFAULT_TIMEOUT_AFTER_SUCCESS_REQUEST = 330; //time after succes request before next request
  
  function getReq() {
  $.ajax( {
     type: "GET",
     url: urlRequest,
     dataType: jsonp,
     cache: false,
     success: getRates,
     beforeSend: function(xhr){
              xhr.withCredentials=true;
              },
     error: onFaultAjaxRequest,
     timeout: DEFAULT_TIMEOUT_AJAX_REQUEST
  });
  }
  
  function getRates(){
  var tab=jXHR.getAllResponseHeaders();
  }
  
  function onFaultAjaxRequest(XMLHttpRequest, textStatus, errorThrown) {
  var t = setTimeout(getReq, DEFAULT_TIMEOUT_AFTER_SUCCESS_REQUEST);
  }
  
  function onSuccessAjaxRequest(returnData) {
  var obj= getReq;
  var arr=$.makearray(obj);
  
  };
  </code></pre>
  
  <p>My index.html page is as follows:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Welcome to MyDomain.com&lt;/title&gt;
  &lt;script type="text/javascript" src="dist/jquery-1.3.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="dist/jquery.jqplot.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/dfc.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  $.jqplot('chartdiv'[onSuccessAjaxRequest]);
  });
  &lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/style.css"/&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="chartdiv"&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I debug index.html, I receive an error stating JScript error "No Data Specified" in the jqplot plugin.  How should I remedy this situation?</p>
  
  <p>Thanks much!!</p>