Advertisement
kotvalera83

UPS Shipping Calculator

May 12th, 2014
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.31 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <!-- converted from php http://www.geekpedia.com/tutorial213_Creating-a-UPS-Shipping-Calculator.html -->
  4.  
  5. <html>
  6.   <head>
  7.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  8.     <meta charset=utf-8 />
  9.     <title>Unofficial UPS Shipping Calculator</title>
  10.   </head>
  11.   <body>
  12.     <form id="shipping">
  13.       Address Type:
  14.       <select name="selResidential">
  15.          <option value="01">Residential</option>
  16.          <option value="02">Commercial</option>
  17.       </select><br />
  18.       Packaging:
  19.       <select name="selPackaging">
  20.          <option value="00">Customer Packaging</option>
  21.          <option value="01">UPS Letter Envelope</option>
  22.          <option value="03">UPS Tube</option>
  23.          <option value="21">UPS Express Box</option>
  24.          <option value="24">UPS Worldwide 25KG Box</option>
  25.          <option value="25">UPS Worldwide 10KG Box</option>
  26.       </select><br />
  27.       Service Type:
  28.       <select name="selService">
  29.          <option value="1DM">Next Day Air Early AM</option>
  30.          <option value="1DA">Next Day Air</option>
  31.          <option value="1DP">Next Day Air Saver</option>
  32.          <option value="2DM">2nd Day Air AM</option>
  33.          <option value="2DA">2nd Day Air</option>
  34.          <option value="3DS">3 Day Select</option>
  35.          <option value="GND">Ground</option>
  36.          <option value="STD">Canada Standard</option>
  37.          <option value="XPR">Worldwide Express</option>
  38.          <option value="XDM">Worldwide Express Plus</option>
  39.          <option value="XPD">Worldwide Expedited</option>
  40.          <option value="WXS">Worldwide Saver</option>
  41.       </select><br />
  42.       Rate:
  43.       <select name="selRate">
  44.          <option value="Regular+Daily+Pickup">Daily Pickup service</option>
  45.          <option value="OP_WEB">Oncall Air Pickup Web (arrange on the web for UPS to pick up my packages)</option>
  46.          <option value="OP_PHONE">Oncall Air Pickup Phone (arrange by phone for UPS to pick up my packages)</option>
  47.          <option value="One+Time+Pickup">One Time Pickup</option>
  48.          <option value="Letter+Center">Drop-box Letter Center</option>
  49.          <option value="Customer+Counter">Customer Counter</option>
  50.       </select><br />
  51.       Package Weight: <input type="text" name="txtPackWeight" value="1" /> pounds<br />
  52.       Package Length: <input type="text" name="txtPackLength" value="5" /> inches<br />
  53.       Package Width: <input type="text" name="txtPackWidth" value="5" /> inches<br />
  54.       Package Height: <input type="text" name="txtPackHeight" value="5" /> inches<br />
  55.       From Zip: <input type="text" name="txtFromZip" value="98052" /><br />
  56.       From City: <input type="text" name="txtFromCity" value="Redmond" /><br />
  57.       From Country: <input type="text" name="txtFromCountry" value="US" /><br />
  58.       To Zip: <input type="text" name="txtToZip" value="94043" /><br />
  59.       To City: <input type="text" name="txtToCity" value="Mountain View" /><br />
  60.       To Country: <input type="text" name="txtToCountry" value="US" /><br />
  61.       <input type="submit" value="Submit" />
  62.     </form>
  63.     <script type="text/javascript">
  64.     $('#shipping').submit(function(e){
  65.       var url = [
  66.         "http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes",
  67.         "10_action=3",
  68.         "13_product="+ $('* [name="selService"]').val(),
  69.         "14_origCountry="+ $('* [name="txtFromCountry"]').val(),
  70.         "15_origPostal="+ $('* [name="txtFromZip"]').val(),
  71.         "origCity="+ $('* [name="txtFromCity"]').val(),
  72.         "19_destPostal="+ $('* [name="txtToZip"]').val(),
  73.         "20_destCity="+ $('* [name="txtToCity"]').val(),
  74.         "22_destCountry="+ $('* [name="txtToCountry"]').val(),
  75.         "23_weight="+ $('* [name="txtPackWeight"]').val(),
  76.         "47_rateChart="+ $('* [name="selRate"]').val(),
  77.         "48_container="+ $('* [name="selPackaging"]').val(),
  78.         "49_residential="+ $('* [name="selResidential"]').val(),
  79.         "25_length="+ $('* [name="txtPackLength"]').val(),
  80.         "26_width="+ $('* [name="txtPackWidth"]').val(),
  81.         "27_height="+ $('* [name="txtPackHeight"]').val()
  82.       ].join('&');
  83.      
  84.       window.open(url); //you want to split output by '%' for it to make sense
  85.       e.preventDefault();
  86.     });
  87.     </script>
  88.   </body>
  89. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement