12345678910111213141516171819202122232425262728293031323334353637383940 |
- // File Name: scrips.js
- // Author Name: In-young Choung
- // Date: March 1, 2017
- // Description: This Javascript file redirects users' input values asynchronously
- // to the end points in python file.
- /**
- * handling form data passed from html and relaying it to python
- *
- * @param itemtype
- * @param brandN1
- * @param brandN2
- * @param price1
- * @param price2
- * @param weight1
- * @param weightT1
- * @param weight2
- * @param weightT2
- * @param discount1
- * @param discountT1
- * @param discount2
- * @param discountT2
- */
- function calc_handle(itemtype, brandN1, brandN2, price1, price2,
- weight1, weightT1, weight2, weightT2,
- discount1, discountT1, discount2, discountT2) {
- // create an object of XMLHttpRequest
- x = new XMLHttpRequest();
- // send an http request to /calculate which is mapped in python
- x.open("GET", '/calculate?param1=' + itemtype + '¶m2=' + brandN1 + '¶m3=' + brandN2 +
- '¶m4=' + price1 + '¶m5=' + price2 + '¶m6=' + weight1 + '¶m7=' + weightT1 +
- '¶m8=' + weight2 + '¶m9=' + weightT2 + '¶m10=' + discount1 + '¶m11=' + discountT1 +
- '¶m12=' + discount2 + '¶m13=' + discountT2);
- // fire the request
- x.send();
- }
|