简体   繁体   中英

Ajax changes drop down menu doesn't remain the same

I have a small issue on a search form. PLease check this: http://www.fortisfitness.ca/test/script.php

What's the problem? When I select the country, the "cities" drop down refreshes with the specific values for that country. All good, but when I select a city, the data is loaded corectly from the database, but the city value from the dropdown menu remains at "All" value.

I use two ajax functions. One for loading data into the table and one for refreshing the dropdown list. Please help . . . Thank you!

its not about your JavaScript code, its somewhere on the server site.

the request of the ajax call, when selecting a city, is like this:

get_city.php?S_City=&D_Country=&D_City=%20Sao%20Miguel%A0&S_Site=&priceh=&time=&pag=1

the response is:

<option SELECTED value="">All</option><option value=""></option><option value=" Äkkilähtö"> Äkkilähtö</option>
...

in your ajax complete function you set the html code of the dropdown with the response:

$("#titles1").html(msg);

as you can see, the response returns the dropdown box with the "all" option selected. so, take a closer look at your php code!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM