title: custom HTTP Response, C# and .ajax()?
body: <p>I'm trying to query a database that contains information about a "ticket" using <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">jQuery's .ajax()</a> method...</p>
  
  <pre><code>$.ajax({
      type: 'GET',
      url: 'Preview.ashx',
      data: 'ticketID=' + ticketID,
      success: function (data) {
  
          // 'data' should be a row from the database, so it should be like an
          // array that contains each column of the row
          // do stuff with this data
      }
  });
  </code></pre>
  
  <p>... so that all works fine. I'm having trouble with the <code>data</code> variable. On the server side, I do...</p>
  
  <pre><code>// get the ticket ID from the POST parameter
  int ticketID = context.Request["ticketID"] != null ? Convert.ToInt32(context.Request["ticketID"]) : -1;
  if (ticketID &gt;= 0) {
  
      // grab the data from the database, getInfo() will retrieve the row
      // in the DB that corresponds to the ticket ID given, returning an 
      // ArrayList with all of the information
      ArrayList theTicket = getInfo(context, ticketID);
  
      // now, I need to somehow return this information so that I could deal with it
      // in the 'success' callback function above
      return;
  } else {
  
      // something went wrong with the 'newTicket' POST parameter
      context.Response.ContentType = "text/plain";
      context.Response.Write("Error with 'ticketID' POST parameter. \n");
      return;
  }
  return;
  </code></pre>
  
  <p>I've debugged this enough to be sure that the ArrayList contains the correct information. Now I just need to return it.</p>
  
  <p>How would I do this? How would I return the data in the ArrayList? Is it possible to structure the response so that I could do <code>data.ID</code>, <code>data.otherColumnName</code>, etc... in the callback function to access the different fields?</p>