[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,9 +103,10 @@
<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>
</div>
</div>
</form>
</form>

View File

@ -85,9 +85,10 @@
<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>
</div>
</div>
</form>
</form>

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) {
@ -80,4 +85,12 @@ 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);
}