Skip to content
Snippets Groups Projects
Commit c05a25fe authored by Kevin Erdiza Yogatama's avatar Kevin Erdiza Yogatama
Browse files

post from java to express

parent 91580599
1 merge request!43KIA -13515016 - Kevin Erdiza Yogatama
...@@ -3,8 +3,31 @@ var destination = null;; ...@@ -3,8 +3,31 @@ var destination = null;;
var pickingpoint = null; var pickingpoint = null;
var idDriver = 0; var idDriver = 0;
var comment = null; var comment = null;
var driver var driver;
function post(path, params, method) {
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
function nextToSelectDriver() { function nextToSelectDriver() {
var prev = 'select-destination'; var prev = 'select-destination';
...@@ -29,6 +52,7 @@ function nextToWaitingForOrder() { ...@@ -29,6 +52,7 @@ function nextToWaitingForOrder() {
var next = 'wait-order'; var next = 'wait-order';
document.getElementById(prev).style.display = 'none'; document.getElementById(prev).style.display = 'none';
document.getElementById(next).style.display = 'block'; document.getElementById(next).style.display = 'block';
post('http://localhost:3000/findorder',{id:idCustomer});
} }
function backToFindOrder() { function backToFindOrder() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment