mirror of
https://codeberg.org/prof_x_pvt_ltd/captive.whump.shanti-portal
synced 2024-08-14 22:46:42 +00:00
url handling and nicer button deactivation
This commit is contained in:
parent
18e6ea66a7
commit
fb5d7b1261
1 changed files with 20 additions and 3 deletions
|
@ -5,19 +5,36 @@
|
|||
|
||||
var debug = true;
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return sParameterName[1] === undefined ? true : sParameterName[1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// This function ensures the user gets redirect to the correct destination once
|
||||
// all jobs have succeeded in the portal software.
|
||||
function do_success() {
|
||||
console.log('success: '+window.location);
|
||||
var url = getUrlParameters('url');
|
||||
|
||||
console.log('success: '+url);
|
||||
|
||||
// Do something like refresh the window or go to another URL.
|
||||
window.location = window.href;
|
||||
location.reload(true);
|
||||
location.replace(url);
|
||||
}
|
||||
|
||||
// Show an error to the user
|
||||
function do_error(message) {
|
||||
console.log('failure: '+message);
|
||||
$('#approveButton').prop('disabled', false);
|
||||
|
||||
$('#error-box').show();
|
||||
$('#form-row').hide();
|
||||
|
|
Loading…
Reference in a new issue