GoMashup Postcode Drop Down List Example

 

This example shows how you can use GoMashup data feeds, jQuery  and JavaScript to create a drop down list:

 


 Australian Capital Teritory Postcode Lookup:

Postcode:

 


Source Code:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
 
    $.getJSON("http://gomashup.com/json.php?fds=geo/australia/postcode/state/ACT&jsoncallback=?", function(data){
      $.each(data.result, function(i,item){
        $("#locality_list").append("<option value='"+item.Pcode+"'>"+item.Locality+"</option>");      
      });
    });
   

  function get_postcode(postcode_value)
    {
     document.getElementById("postcode").innerHTML = "Postcode: "+ postcode_value;
    }    
</script>

  <form>
       <select id="locality_list" onChange="get_postcode(this.value)">
       <option selected value="">Select Location</option>  
       </select>
</form>
 <div id="postcode">Postcode: </div>