I am using jQuery to publish to an ASP.NET web service to implement a custom autocomplete function. The code works fine, except that it is slow in FireFox (cannot make it work faster than 1 second). IE is blazing fast - works great. I am watching a post in Firefox using Firebug.
Here's the service code:
<ScriptService(), _ WebService(Namespace:="http://tempuri.org/"), _ WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1), _ ToolboxItem(False)> _ Public Class TestWebSvc Inherits System.Web.Services.WebService <WebMethod(), _ ScriptMethod(ResponseFormat:=Script.Services.ResponseFormat.Json, UseHttpGet:=True)> _ Public Function GetAccounts(ByVal q As String) As Object 'Code taken out for simplicity Return result End Function End Class
And jQuery ajax call:
$.ajax({ beforeSend: function (req) { req.setRequestHeader("Content-Type", "application/json"); }, contentType: "application/json; charset=utf-8", type: "GET", url: "http://localhost/Suggest/TestWebSvc.asmx/GetAccounts", data: "q='" + element.val() + "'", dataType: "json", success: testWebSvcSuccess });
As you can see, I tried using the HTTP GET verb instead in the hope that this would speed up the call. Since this is not the case, I will probably return to using POST if I can. Right now, I'm just focusing on why it is super fast in IE and super slow in Firefox.
Versions: jQuery 1.3.2; Firefox 3.0.11; IE 8.0.6001.18783 (64-bit)
Thanks for any information you can provide.
source share