title: jQuery AJAX Post using asp.net
body: <p>I am getting an error back on a jQuery ajax post.  </p>
  
  <p>The error I receive in IE is SyntaxError: Invalid character.</p>
  
  <p>The entire project can be found at: <a href="http://dragsort.codeplex.com/" rel="nofollow">http://dragsort.codeplex.com/</a> </p>
  
  <p>When you move one of the boxes to another location (click and drag) the ajax post occurs.</p>
  
  <p>In order to display the error I had to add the error ajax property to the jQuery ajax call.</p>
  
  <pre><code>function saveOrder() {
  var data = $("#gallery li").map(function() { return $(this).attr("itemID"); }).get();
  $.ajax({ 
      url: "example.aspx/SaveListOrder", 
      data: '{ids:["' + data.join('","') + '"]}', 
      dataType: "json", 
      type: "POST", 
      contentType: "application/json; charset=utf-8",
      error: function(data, status, jqXHR) { alert(jqXHR); }
  });
  };
  </code></pre>
  
  <p>Code behind Method</p>
  
  <pre><code>[WebMethod]
  public static void SaveListOrder(int[] ids)
  {
      for (int i = 0; i &lt; ids.Length; i++)
      {
          int id = ids[i];
          int ordinal = i;
          //...
      }
  }
  </code></pre>
  
  <p>Any ideas on what the issue is?  Thanks in advance.</p>
  
  <p><strong>EDIT/ANSWER:</strong></p>
  
  <p>The problem is in the web.config. I added the following httpModule in the web.config</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;system.web&gt;    
      &lt;httpModules&gt;
        &lt;add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
      &lt;/httpModules&gt;
    &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>If anyone would like to elaborate on why this is needed that would be great.  I'll create a post as the answer once i'm allowed to do so.</p>
  
  <p>Thanks!</p>