0

I am loading the contents of a combo box from XML via JQuery

The XML has 430 Elements (all these will be part of the drop down list)

I am using JQuery ($.get) to the data and fill the drop down list

It takes ~30 seconds to 1 min to load.

I am wondering if there are any ways to speed up / cache the data

below is my code

<select data-placeholder="Choose Categories..." id="catOptions" class="chosen-select" multiple style="width: 500px;" tabindex="1">
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.get('<%=ResolveUrl("~/Configuration/Categories.xml")%>', function (d) {
                    $(d).find('category').each(function () {
                        var opt = '<option value="' + $(this).text() + '">' + $(this).text() + '</option>';
                        $("#catOptions").append($(opt)).trigger("chosen:updated");
                    });
                    return false;
                });
            });
        </script>
    </select>

XML looks like this

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<categories>
  <category>Unassigned/Test</category>
  <category>Unassigned/SW</category>
...
</categories>

Data for the XML is being populated by another application

Bhavin Solanki
  • 4,740
  • 3
  • 26
  • 46
KK99
  • 1,971
  • 7
  • 31
  • 64
  • Where is the bottleneck? Network? Server? Database? Client? There are a lot of options here, depending on where the problem actually is. – Palpatim Aug 20 '15 at 16:33
  • Well I am still developing the application in asp.net and in local host I see this time. I even have SSD. The XML is part of the Asp.net project – KK99 Aug 20 '15 at 16:35
  • In all likelihood, you'll want to focus on the server-side code and data store, but you should profile your application end-to-end to find where the time is actually being taken up. Put timing metrics in your code, or even log statements showing the beginning and end of code execution, and you'll probably be able to narrow it down pretty quickly. It's worth it to think about those hooks early, and consider how they can be included in you process going forward. – Palpatim Aug 20 '15 at 16:38
  • I am reading a static xml in this case – KK99 Aug 20 '15 at 16:44

0 Answers0