[add] reloading

This commit is contained in:
Jose Pabl Domingo Aramburo Sanchez 2018-08-30 22:14:04 +00:00
parent 627da598fd
commit 07e0fbbfab
4 changed files with 19 additions and 3 deletions

View File

@ -103,6 +103,7 @@
<div class="row col-md-offset-6">
<div class="form-group">
<a href="#" class="btn btn-lg btn-success " onclick="updateEmployee();">Update</a>
<a href="#" class="btn btn-lg btn-primary " onclick="loadView(currentView);">Clear</a>
</div>
</div>
</div>

View File

@ -85,6 +85,7 @@
<div class="row col-md-offset-6">
<div class="form-group">
<a href="#" class="btn btn-lg btn-success " onclick="saveNewEmployee();">Create</a>
<a href="#" class="btn btn-lg btn-primary " onclick="loadView(currentView);">Clear</a>
</div>
</div>
</div>

View File

@ -134,6 +134,7 @@
<div class="row col-md-offset-6">
<div class="form-group">
<a href="#" class="btn btn-lg btn-success " onclick="processSaveActionWorkDay();">Save</a>
<a href="#" class="btn btn-lg btn-primary " onclick="loadView(currentView);">Clear</a>
</div>
</div>
</div>

View File

@ -1,3 +1,6 @@
// will contain the current loaded view
let currentView;
/**
* Destorys the session for the current user and redirects
* back to the login form
@ -59,6 +62,8 @@ function loadView(requestedView){
url: baseUrl + '/html/' + requestedView,
type: 'get',
success:function(data){
currentView = requestedView;
$("#newViewBody").hide().html(data).show('slow');
},
error:function(x,e) {
@ -81,3 +86,11 @@ function loadView(requestedView){
},
});
}
/**
* Reloads the last view that was accessed as a way of fully clearing and
* resetting the values of the form
*/
function clearView(view){
loadView(view);
}