title: Calling ajax request from html page inside asp.net project
body: <p>I cannot get a simple ajax example to work from an html page inside my visual studio project.  It works fine from a webform (aspx):</p>
  
  <p>...
  webform1.aspx and form1.html
  ...</p>
  
  <pre><code>function ShowCurrentTime() {
              alert("before json");
              $.ajax({
                  type: "POST",
                  url: "json.aspx/GetCurrentTime",
                  data: "{name: bob }",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: OnSuccess,
                  failure: function (response) {
                      alert(response.d);
                  }
  
              });
              alert("after json");
          }
  
          function OnSuccess(response) {
              alert(response.d);
          }
  </code></pre>
  
  <p>...
  webform1.aspx and form1.html
  ...</p>
  
  <pre><code>&lt;input id="btnGetTime" type="button" value="Show Current Time"
                     onclick="ShowCurrentTime()" /&gt;
  </code></pre>
  
  <p>...
  json.aspx
  ...</p>
  
  <pre><code>[WebMethod]
          public static string GetCurrentTime(string name)
          {
              return "Hello " + name + Environment.NewLine + "The Current Time is: "
                  + DateTime.Now.ToString();
          }
  </code></pre>
  
  <p>If I put the code in webform1.aspx, it works fine.  If I put it on form1.html, nothing comes back from json.aspx.  I am running the project in debug mode from my machine using vs2013.  Any help would be appreciated.</p>
  
  <p><strong>Update #1</strong></p>
  
  <p>I checked fiddler and the server is returning the following result (500):</p>
  
  <p>{"Message":"Invalid JSON primitive: bob.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n   at ...</p>