javascript - Estimate shipping delivery date -
i would grateful if can me out this.
i looking create add html/js page once customer puts country in drop down menu , clicks submit, produces estimated delivery date.
the best way use map engine (like google maps api or nokia here) , calculate distance. complex , in situation over-sized.
i did country-code list once , can use archive want. use json , add new option distance
it. have add select:
$(function() { var countrycodes=[ {"image":"ae.png","nameen":"united arab emirates","code":"ae","distance":2}, {"image":"us.png","nameen":"united states","code":"us","distance":1}, {"image":"vn.png","nameen":"viet nam","code":"vn","distance":4}, {"image":"cn.png","nameen":"china","code":"cn","distance":3} ]; $(countrycodes).each(function(i,value) { $("#sendingcountry").append("<option value=" + value.distance + ">"+ value.nameen +"</option"); }); $("#calculate").click(function() { var result=$("#sendingcountry").val()*$("#sendingtype").val(); $("#result").text("your order shipped within "+result+" day."); }); });
see this fiddle details.
Comments
Post a Comment