I created a script which get from my database the states and price of shipping by number of products.
So…I have 2 dropdown, one for quantity and the second one for state.
This is my main php file: http://pastebin.com/U6dncsZ6
This is the second php file (for database connect) – findcity.php : http://pastebin.com/AuEXrnpD
As you see, in my second php file I have this line:
<option value=<?=$row['price']?>><?=$row['title']?></option>
I want to display the shipping price from the database ($row[‘price’] on the page.
I specify that using “Inspect element” in my browser I can see the prices added as value for the states, like:
<option value="48.11">State</option>
Please help 🙁
Le: As I stated in a comment, I finally found that like here it’s working: jsfiddle.net/Dkn4n/1/
But for some reasons, it’s not detected but it’s not working in my page, maybe because the value is not set in html, I can’t see the values in source, only in “Inspect element”. The value is set as I specified above, with $row[‘price’]
Adding to “Chase”s Answer:
and expanding it:
at this line:
document.getElementById(‘provinciadiv’).innerHTML=req.responseText;
do
again!
Because the “change” binding is gone once you replace the part…