JQuery ajax call to ASP.NET handler always returns error

Ojatro

New Member
I'm writing a client for an asp.net handler that processes and sends notifications to the polling clients. I make ajax calls with jquery every 10 seconds waiting for the notifications. The problem is every time I send a response back to the client it always calls the error callback. With fiddler I see the json response arriving to the client with status 200 but in firebug the request keeps waiting.Client:\[code\]function poll(){$.ajax({ url: "http://localhost:53914/NotificationChecker.ashx", data: { userName: "ggyimesi" }, type: 'POST', success: function(data){ alert("asd"); $('div#mydiv').text(data.Text); }, complete: poll, error: function(data){alert(data.status);}, timeout: 15000 });} $(document).ready(function(){ poll();} );\[/code\]Server:\[code\]Response response = new Response();response.Text = this.MessageText;response.User = Result.AsyncState.ToString();string json = JsonHelper.JsonSerializer<Response>(response);Result.Context.Response.ContentType = "application/json";Result.Context.Response.Write(json);\[/code\]
 
Back
Top