title: Get data from aspx.cs page to aspx page
body: <p>So I am using a jquery plug in that allows me to change the order of things in a list by dragging and dropping them. 
  So my goal is to be able to grab a list of my objects (AlertInfo) and using it in a javascript function. 
  I was able to use a json webservice call in a test project to pass the data to the page.
  But we don't have a webservice page now so I tried to grab it from a aspx.cs page and it hasn't worked. </p>
  
  <p>///Aspx page:</p>
  
  <pre><code>$.ajax({
     type: "POST",
     url: "~/Alerts/GetAlerts",
     data: "{}",
     contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (msg) {
          var data = eval("(" + msg.d + ")");
          jQuery.each(data, function (rec) {
          AlertList[AlertList.length] = new objAlert(this.id, this.title, this.details,               JSONDateSerializationFix(this.startdate), JSONDateSerializationFix(this.enddate));
          UpdateDisplayList();
       })
       },
       error: function (msg) {
          alert("BRAD" + msg);
       }
  </code></pre>
  
  <p>The issue is that the Alerts page in "URL /Alerts/GetAlerts" is Alerts.aspx.cs.  I can't figure out if I can use this ajax command to call a method in a aspx.cs page.<br>
  //Code behind page aspx.cs</p>
  
  <pre><code>[WebMethod]
   //[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  public string GetAlerts()
  {
    List&lt;AlertInfo&gt; list = AlertInfo.GetTestAlerts();
    return new JavaScriptSerializer().Serialize(list);
  }
  
  public List&lt;AlertInfo&gt; GetAlertsList()
  {
    List&lt;AlertInfo&gt; list = AlertInfo.GetTestAlerts();
    return list; ;
  }
  </code></pre>
  
  <p>So I was hoping that I could load data into an asp control (dataList) and then grab the data</p>
  
  <p>//code behind page</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      dataListAlertList.DataSource = GetAlertsList();
      dataListAlertList.DataBind();
  }
  public static List&lt;AlertInfo&gt; GetTestAlerts()
  {
              List&lt;AlertInfo&gt; list = new List&lt;AlertInfo&gt;();
              list.Add(new AlertInfo("0", "Alert 1 Title", "Alert 1 Detail", "10/10/2010", "10/10/2011"));
              list.Add(new AlertInfo("1", "Alert 2 Title", "Alert 2 Detail", "10/10/2010", "10/10/2011"));
              return list;
  </code></pre>
  
  <p>}</p>
  
  <p>//.aspx page</p>
  
  <pre><code>$(document).ready(function () {
      var a1 = $("#dataListAlertList").val();
      // do fun stuff now.
  }
  </code></pre>
  
  <p>But I keep getting undefined....</p>