title: How to keep dropdown selected after refresh using jquery
body: <p>I am using jquery to refresh a page when someone selects an item in a drop down. But then it revolves back the default selected. </p>
  
  <p>(This prevents users from making a search using both drop downs.)</p>
  
  <p>How do I get the drop down to save the item selected on page refresh?</p>
  
  <p>Code Below:</p>
  
  <pre><code>&lt;%@ LANGUAGE="VBSCRIPT" %&gt;
  &lt;%
  pagetitle="Contractor Details"
  %&gt;
  &lt;!--#INCLUDE VIRTUAL="/_lib/include/header.htm"--&gt;
  &lt;!--#INCLUDE VIRTUAL="/_lib/include/menu.htm"--&gt;
  &lt;script&gt;
  $(document).ready(function() {
      $("#abn,#cat").change(function () {
      this.form.submit();
  })
  });
  &lt;/script&gt;
  &lt;div class="twoColumnRow"&gt;
  &lt;div class="twoColumnContent"&gt;
  &lt;p class="breadCrm"&gt;&lt;a href="/index.htm"&gt;Home&lt;/a&gt; &lt;span&gt;&amp;gt;&lt;/span&gt; &lt;a href="/tools/index.htm"&gt;Tools of the Trade&lt;/a&gt; &lt;span&gt;&amp;gt;&lt;/span&gt; &lt;a href="/tools/finance/index.htm"&gt;Finance and Purchasing&lt;/a&gt;&lt;span&gt;&amp;gt;&lt;/span&gt; &lt;a href="/tools/finance/procurement/index.htm"&gt;Procurement and Contracts information&lt;/a&gt;&lt;/p&gt;
  &lt;div class="contentPad"&gt;
  &lt;!-- Start of main content --&gt;
  
  &lt;p class="imageRight"&gt;&amp;nbsp;&lt;/p&gt;
  &lt;h1&gt;&lt;%=pagetitle%&gt;&lt;/h1&gt;
  
  &lt;%
          Dim connectString, connect, conDB, sconDB, con, scon, src_abn, src_cat
          connectString = "Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=" &amp; Server.MapPath("data")
                src_abn = Request.QueryString("abn")
                src_cat = Request.QueryString("cat")
          set connect = Server.CreateObject("ADODB.connection")
          connect.open connectString
  
          if src_abn = "all" and src_cat = "all" then
          conDB = "SELECT * FROM cont.csv"    
          elseif src_abn = "all" then
          conDB = "SELECT * FROM cont.csv WHERE " &amp; src_cat &amp; " = 'Yes'"  
          elseif src_cat = "all" then
          conDB = "SELECT * FROM cont.csv WHERE ucase(abn) LIKE ucase('%"+src_abn+"%')"   
          else 
          conDB = " SELECT * FROM cont.csv WHERE " &amp; src_cat &amp; " = 'Yes' AND ucase(abn) LIKE ucase('%"+src_abn+"%')"
          end if
  
          sconDB = "SELECT * FROM cont.csv"   
  
          set con = connect.execute(conDB)
          set scon = connect.execute(sconDB)
  %&gt;
  &lt;h2&gt;Search results&lt;/h2&gt;&lt;hr /&gt;
  &lt;% if not con.BOF then %&gt;
  &lt;div style="margin-top:1em"&gt;
  
    &lt;form action="dbresults.htm" method="get"&gt;
  
        &lt;p&gt;Company name:&lt;br/&gt;
        &lt;select id="abn" name="abn"&gt;
          &lt;option label="All companies" value="all"&gt;&lt;/option&gt;
          &lt;% while (NOT scon.EOF) %&gt;
          &lt;option label="&lt;%=scon("legal")%&gt;" value="&lt;%=scon("abn")%&gt;"&gt;&lt;/option&gt;
          &lt;%scon.MoveNext()
                            Wend %&gt;
        &lt;/select&gt;
        &lt;/p&gt;
       &lt;p&gt;Categories for Creative Design:&lt;br/&gt;
        &lt;select id="cat" name="cat"&gt;
          &lt;option class="group" label="All categories" value="all"&gt;&lt;/option&gt;
          &lt;option class="group" label="Strategic brand, marketing and communications advice" value="a"&gt;&lt;/option&gt;
          &lt;option class="group" label="Graphic design and layout" value="b"&gt;&lt;/option&gt;
          &lt;option class="group" label="Forms design" value="c"&gt;&lt;/option&gt;
          &lt;option class="group" label="Web design and development" value="d"&gt;&lt;/option&gt;
          &lt;option class="group" label="Authoring services" value="e"&gt;&lt;/option&gt;
          &lt;option class="group" label="Editorial services" value="f"&gt;&lt;/option&gt;
          &lt;option class="group" label="Translation services" value="g"&gt;&lt;/option&gt;
          &lt;option class="group" label="Photography and film services" value="h"&gt;&lt;/option&gt;
          &lt;option class="group" label="Scanning and digitisation services" value="i"&gt;&lt;/option&gt;
          &lt;option class="group" label="Multimedia editing services" value="j"&gt;&lt;/option&gt;
        &lt;/select&gt;
      &lt;/p&gt;
      &lt;input type="submit" value="Search" /&gt;
    &lt;/form&gt;
    &lt;br /&gt;&lt;hr /&gt;
  
      &lt;table style="font-size:.9em;" class="contentTable"&gt;
            &lt;tr&gt;
                  &lt;th&gt;ABN:&lt;/th&gt;
                  &lt;th&gt;Company Name:&lt;/td&gt;
            &lt;/tr&gt;
    &lt;% con.Movefirst() %&gt;
    &lt;% while (NOT con.EOF) %&gt;
            &lt;tr&gt;
                  &lt;td&gt;&lt;%=con("abn")%&gt;&lt;/th&gt;
                  &lt;td&gt;&lt;a href="dbcomp.htm?abn=&lt;%=con("abn")%&gt;&amp;cat=all"&gt;&lt;%=con("legal")%&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
    &lt;%
      con.MoveNext()
      Wend
    %&gt;
  &lt;/table&gt;
  
  &lt;/div&gt;
  &lt;% else %&gt;
      &lt;% scon.Movefirst() %&gt;
    &lt;form action="dbresults.htm" method="get"&gt;
  
        &lt;p&gt;Company name:&lt;br/&gt;
        &lt;select name="abn"&gt;
          &lt;option label="All companies" value="all"&gt;&lt;/option&gt;
          &lt;% while (NOT scon.EOF) %&gt;
          &lt;option label="&lt;%=scon("legal")%&gt;" value="&lt;%=scon("abn")%&gt;"&gt;&lt;/option&gt;
          &lt;%scon.MoveNext()
                            Wend %&gt;
        &lt;/select&gt;
        &lt;/p&gt;
       &lt;p&gt;Categories for Creative Design:&lt;br/&gt;
        &lt;select name="cat"&gt;
          &lt;option label="All categories" value="all"&gt;&lt;/option&gt;
          &lt;option label="Strategic brand, marketing and communications advice" value="a"&gt;&lt;/option&gt;
          &lt;option label="Graphic design and layout" value="b"&gt;&lt;/option&gt;
          &lt;option label="Forms design" value="c"&gt;&lt;/option&gt;
          &lt;option label="Web design and development" value="d"&gt;&lt;/option&gt;
          &lt;option label="Authoring services" value="e"&gt;&lt;/option&gt;
          &lt;option label="Editorial services" value="f"&gt;&lt;/option&gt;
          &lt;option label="Translation services" value="g"&gt;&lt;/option&gt;
          &lt;option label="Photography and film services" value="h"&gt;&lt;/option&gt;
          &lt;option label="Scanning and digitisation services" value="i"&gt;&lt;/option&gt;
          &lt;option label="Multimedia editing services" value="j"&gt;&lt;/option&gt;
        &lt;/select&gt;
      &lt;/p&gt;
      &lt;input type="submit" value="Search" /&gt;
    &lt;/form&gt;
    &lt;br /&gt;&lt;hr /&gt;
  &lt;p&gt;No records match your query.&lt;/p&gt;
  &lt;p&gt;&lt;a href="dbtest.htm"&gt;Return to search page&lt;/a&gt;&lt;/p&gt;
  &lt;%
    end if
    con.close
  %&gt;
  
  
  &lt;!-- End of main content --&gt;
  &lt;/div&gt; &lt;!-- end contentPad div --&gt;
  &lt;/div&gt; &lt;!-- end twocolumncontent div --&gt;
  &lt;div class="twoColumnLinks"&gt;
  
  &lt;!--&lt;div class="relatedLinks"&gt;
  &lt;h3&gt;Related Links&lt;/h3&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;a href="/index.htm"&gt;Related link 1&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;--&gt; &lt;!-- end relatedlinks div --&gt;
  &lt;!--#INCLUDE VIRTUAL="/_lib/include/quicklinks.htm"--&gt;
  &lt;!--#INCLUDE VIRTUAL="/_lib/include/mylinks.htm"--&gt;
  &lt;/div&gt; &lt;!-- end twocolumnlinks div --&gt;
  &lt;/div&gt; &lt;!-- end twocolumnrow div --&gt;
  &lt;!--#INCLUDE VIRTUAL="/_lib/include/footer.htm"--&gt;
  </code></pre>