1// Array of json objects 2var statesRates = [{ 3 "State": "New Work", 4 "Rate": 100 5}, { 6 "State": "Delhi", 7 "Rate": 150 8}, { 9 "State": "California", 10 "Rate": 125 11}, { 12 "State": "Perth", 13 "Rate": 170 14}] 15 16// Create the Dropdown with State Names / Values 17 18function createList() { 19 20 // Loop through each object in json array 21 for (var i = 0; i < statesRates.length; i++) { 22 23 // Define variables for key / value pairing 24 var stateName = statesRates[i].State; 25 var stateRate = statesRates[i].Rate; 26 27 // Create <option> element with dropdown 28 jQuery("#state").append('<option value="' + stateRate + '">' + stateName + '</option>'); 29 30 } 31} 32 33 34 35// Calculate Cost function 36 37function calculateCost() { 38 39 // Get Values of Inputs 40 var squareFeet = $("#square-feet").val(); 41 var state = $("#state").val(); 42 var totalCost = state; 43 44 if (squareFeet > 375) { 45 $("#shipping-estimate").html("Sorry, we only allow online order estimates for one pallet product (300 KG). Please contact us for more information."); 46 } else { 47 $("#shipping-estimate").html("The shipping estimate to this state is $" + totalCost); 48 } 49} 50 51// Calculate Cost when button is clicked 52createList(); 53 54jQuery("#calculate").click(function() { 55 calculateCost; 56});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.