title: ASP.NET 4 jquery ajax webmethod call
body: <p>In ASP.NET 3.5 I had this javascript on a page (default.aspx):</p>
  
  <pre><code>function getMoreNewsItems() {
      $.ajax({
          type: "POST",
          url: "default.aspx/LoadNewsItems",
          data: "{}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (msg) {
              alert(msg.d);
          }
      });
  }
  </code></pre>
  
  <p>With this in the code behind (default.aspx.cs):</p>
  
  <pre><code>[System.Web.Services.WebMethod]
  public static string LoadNewsItems() {
      return "test1";
  }
  </code></pre>
  
  <p>I have a ScriptManager on the page with EnablePageMethods=true. All worked fine. </p>
  
  <p>Now the project upgraded to ASP.NET 4.0 and is using the new url routing functionality. The AJAX call doesn't work anymore. In FireBug I see it returns the complete page, instead of the XML response.</p>
  
  <p>What has changed in ASP.NET 4 that could be causing this error?</p>