title: jquery ajax 200 OK JSON.ParseError
body: <p>I have a control which has a textbox which, when its content changes, will tricker this javascript function:</p>
  
  <p><code>page</code> parameter is <code>document.URL</code> as the control has no attached .asxc page and <code>fieldValue</code> is value of the textbox.</p>
  
  <pre><code>function UpdateFieldsOnListSelection(page, fieldValue) {
      $.ajax({
          type: "POST",
          url: page + "/IsSelectedListPictureLibrary",
          data: { "libraryInfo": fieldValue },
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (data) {
              alert("Success!");
          },
          error: function (jqXHR, textStatus, errorThrown) {
              alert("jqXHR: " + jqXHR.status + "\ntextStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
          }
      });
  };
  </code></pre>
  
  <p>It keeps throwing this error:</p>
  
  <blockquote>
    <p>jqXHR: 200<br>
    textStatus: parsererror<br>
    errorThrown: SyntaxError: JSON.parse: unexpected character</p>
  </blockquote>
  
  <p>The code for <code>IsSelectedListPictureLibrary</code>:</p>
  
  <pre><code>[WebMethod]
  public static bool IsSelectedListPictureLibrary(string libraryInfo)
  {
      if (string.IsNullOrEmpty(libraryInfo)) return false;
  
      var common = new Utility();
      var storedLibraryInfo = common.GetStoredLibraryInfo(libraryInfo);
  
      if (storedLibraryInfo == null) return false;
  
      var web = SPContext.Current.Site.OpenWeb(storedLibraryInfo.WebId);
      var spList = web.Lists[storedLibraryInfo.LibraryId];
  
      if (spList.BaseTemplate == SPListTemplateType.PictureLibrary)
      {
          web.Dispose();
          return true;
      }
  
      web.Dispose();
      return false;
  }
  </code></pre>
  
  <p>I have tried changing <code>json</code> in the ajax to <code>jsonp</code>, but same error occured.<br>
  I tried changing the format of <code>data</code>.</p>
  
  <p>Any ideas?</p>