title: Get json data via ajax
body: <p>Hopefully this is a fairly easy question. Pardon my ignorance, but I am mostly a PHP/Zend developer, so i am struggling a little in C# and Visual Studio with a json/ajax issue.  Is there something obvious I am missing? Any help will be appreciated. Should I be looking at <code>List&lt;&gt;</code>?</p>
  
  <p>Here is the error I receive when I fire the javascript ajax function:
  "Unknown web method getwidgets."</p>
  
  <p>I have a dataset in C#, that I run through a JSON converter method.  This works well and returns my data in a JSON string.</p>
  
  <pre><code>private widgetsBL widgetsBLObject = new widgetsBL();
  
  [WebMethod]
  public String getwidgets()
  {
      DataSet results = new DataSet();
      results = widgetsBLObject.selectTheWidgets();
  
      string jsresults = MyClassLibrary.JqueryTools.GetJSONString(results.Tables[0]);
      return jsresults;
  }
  </code></pre>
  
  <p>Here is the jsresults:</p>
  
  <pre><code>{"Table" : [  {"widgetid" : "1","widgetname" : "gizmo1000","widgetdescription" : "very cool widget"},
  {"widgetid" : "2","widgetname" : "gizmo2000","widgetdescription" : "decent widget"},
  {"widgetid" : "3","widgetname" : "gizmo3000","widgetdescription" : "terrible widget"}     ]}
  </code></pre>
  
  <p>My Javascript call:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "my.aspx/getwidgets",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (data) {
         // do stuff with returned data
      }
  });
  </code></pre>