title: Ajax Success event does not fire when calling service
body: <p>I am using JQuery to make a AJAX to a local service.  My local service is a HttpHandler (e.g., Request.ashx).  Within Request.ashx, it's responsiblity is to make a call to an external website (e.g., CallExternalWebsite()).  CallExternalWebsite() uses .NET's System.Net.WebRequest() to initiate a request.  When the external website is accessed, neither the success or error events are fired.  (<em>NOTE:  I have also tried this a WCF service hosted in IIS.  I am seeing the same results</em>)</p>
  
  <p>Here are two scenarios:</p>
  
  <p>This scenario works:</p>
  
  <ol>
  <li>In ProcessRequest(), <em>comment out</em> callExternalWebsite().</li>
  <li>For object o, intialize with data to simulate results.</li>
  <li>Click on myButton</li>
  <li>The success event fires on the client.</li>
  <li>In Fiddler, I can see the header info.  I see Json result, etc.</li>
  </ol>
  
  <p>This scenario does not work:</p>
  
  <ol>
  <li>In ProcessRequest(), <em>enable</em> the call for callExternalWebsite().</li>
  <li>For object o, callExternalWebsite() will return an appropriate object.</li>
  <li>Click on myButton</li>
  <li>The success event <em>does not</em> fires on the client.</li>
  <li>In Fiddler, I can see the header info.  I see Json result, etc.</li>
  <li>I know the callExternalWebsite() is working because I have it sending results to my phone.</li>
  </ol>
  
  <p>To sum it up, the external http call within the HttpHandler is effecting the Ajax success event.</p>
  
  <p>Here is a snippet from AJAX call:
  (I was trying different interations)</p>
  
  <pre><code>    $(document).ready(function () {
          $("#myButton").click(function (event) {
  
              $.ajax({
                  cache: false,
                  type: "POST",
                  url: "http://localhost/Service/Request.ashx",
                  data: '{"id" : "053252f3"}',
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  timeout: 20000,
                  success: function (msg) {
                      AjaxSucceeded(msg);
                  },
                  error: AjaxFailed
              });
          });
      });
  </code></pre>
  
  <p>In the HttpHandler Request.ashx,</p>
  
  <pre><code>public Void ProcessRequest(httpContent context)
  {
  //  Do some stuff....
  
  // Make call to external web site
  object o = callExternalWebsite (Uri, Data, "POST");
  
  // Return results from callOtherWebsite 
          JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
          string json = javaScriptSerializer.Serialize(o);
          context.Response.ContentType = "application/json";
          context.Response.Write(json);
  
  }
  </code></pre>
  
  <p>Any thoughts?</p>
  
  <p>Thanks.</p>
  
  <p>Steve</p>