I am .ajax() jQuery .ajax() call that returns a List<string> IP addresses in the specified subnet. I use [WebMethod] on the .aspx page to return values. ASP.NET's built-in JSON serializer does the magic to return the actual JSON used in my Javascript.
I have profiled the time on the server side, and it takes about 8 ms to populate and return the list, so server code is not a problem.
However, when an Ajax call is initiated, Internet Explorer may take up to 3 seconds to populate a list with a small list of returned IP addresses. In Firefox, the list is essentially populated instantly.
I'm not quite sure where the bottleneck could be. My best guess is that the error is related to the IE6 javascript engine, but even so, adding only 255 list items should not take much time.
Can someone point me in the right direction why this is happening?
Code example
$.ajax({ type: "POST", url: $("Example.aspx/GetIPsOnNetwork", data: "{NetworkID: " + networkID + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { $('#ipAddresses').empty(); // Loop through each IP address and add it to the listbox $.each(data.d, function(){ var ip = this.toString(); $(document.createElement('option')).attr('value', ip).text(ip).appendTo('#ipAddresses'); }); }, error: function(msg) { alert('Error: ' + msg); } });
source share