Reading JSON file based on dropdown item selected


i have code shown below.

 

i trying read data json file based on criteria, in instance suburbs within given territory

 

i can quite in liquid hard coding territory, however, want use value of <select> option chosen

 

i understand cannot achieved javascript, possible other way?

 

<select id="territory">

    <option value="xx">-- please select --</option>

    <option value="cbd">cbd</option>

    <option value="north">north</option>  

    <option value="south">south</option>

</select>

 

{module_json json="/_system/shipping/shipping.json" template="" collection="shipping"}

<select id="suburb">

    <option value="xx">-- please select --</option>

    {% item in shipping.territory %}

         {% if item.territory == "<value above select>" %}

            <option value="{{item.postcode}}">{{item.suburb}}</option>          

         {% endif %}

    {% endfor %}

</select>

not sure mean can not done javascript. use in case.

if using javascript framework jquery example.

you have change event on select , current value (the 1 selected) populate or ever want that.

if reading json file can use getjson example:

http://api.jquery.com/jquery.getjson/



More discussions in Developer forum


adobe

Comments

Popular posts from this blog

Soustraire une selection

After Effects: could not find dvaeve_dialogs.txt

Illustrator cs6 "Invalid Serial Number"