Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Return Select Box to Default State Without Refreshing The Page - Ajax - JQuery

Avatar of DanielR6
DanielR6Flag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScriptAJAXjQuery
8 Comments1 Solution1515 ViewsLast Modified:
Hi EE

I've searched around trying to find a solution to this little problem. I have two select boxes, both are populated from a database, the second box is updated via Ajax after the 1st has a selection made. When the first box has a selection made it displays a 'clear selection' text link which I'd like to refresh the 1st select box but without refreshing the page. Im using both Ajax and Jquery in my project. Im also looking at having another link appear underneath the second select box if a selection is made on that, so I need the links to be relevant to each object.

Help on this would be appreciated

---- The code below is the asp file which is pulled in from the Ajax request. ----
<%
dim conn
dim sql
dim manuvalue
manuvalue = request.querystring("man-select")
response.expires=-1
sql= "SELECT DISTINCT ModelID FROM troika_stock WHERE Show = true AND ManufacturerID= "
sql=sql & "'" & manuvalue & "'"
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("stock.mdb"))
set RS=Server.CreateObject("ADODB.recordset")
RS.Open sql,conn
if manuvalue <> "" then 
response.write "<div class=""clearlist""" & ">" & "<a href=""#"""  & ">" & "clear results" & "</a>" & "</div>"
end if
response.write "<select id=""mod-select""" & "class=""searchbox-dd""" & vbCRLF
if manuvalue = "" then 
response.write "disabled"
end if	
response.write ">"
response.write("<option selected=""selected""" & "class=""searchbox-dd-item""" & "value=""""" & ">" & "[ All Models]" & "</option>")	
response.write("<optgroup label='Models'"">")
if not RS.eof then
do while not RS.eof					
response.write ("<option value=""" & RS("ModelID") & """" & "class=""searchbox-dd-item""" & ">" & RS("ModelID") & "&nbsp;&nbsp;"  & "</option>")
RS.movenext
loop
end if             
response.write("</optgroup>")      
response.write ("</select>")
RS.close
set RS = nothing
conn.close
set conn =nothing
%>
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0ttFlag of United States of America imageIT Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers