Initial commit for radiantprestation project
This commit is contained in:
74
Bootstrap/js/custom.js
Normal file
74
Bootstrap/js/custom.js
Normal file
@@ -0,0 +1,74 @@
|
||||
function load(page) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : page,
|
||||
success : function(data) {
|
||||
try {
|
||||
$('#content').html(data);
|
||||
} catch (err) {
|
||||
// alert(err);
|
||||
alert("load page : "+err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function push(page)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
beforeSend : function() {
|
||||
$('.help-blok').remove();
|
||||
},
|
||||
type : 'GET',
|
||||
url : page,
|
||||
success : function(data) {
|
||||
// alert(data);
|
||||
|
||||
console.log(data);
|
||||
|
||||
try {
|
||||
|
||||
console.log('Data has been pushed..');
|
||||
|
||||
var res = jQuery.parseJSON(data);
|
||||
|
||||
if (res.result) {
|
||||
|
||||
$.each(res, function(key, value) {
|
||||
|
||||
if (key == 'reload') {
|
||||
|
||||
load(value);
|
||||
|
||||
// alert('Data saved..'); // ajout KANE
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else if (res.result == false) {
|
||||
|
||||
$.each(res, function(key, value) {
|
||||
|
||||
if (key != 'result' && key != 'server' && key != 'notif' ) {
|
||||
|
||||
$('#'+key).after("<span class='help-blok'>"+value+"</span>")
|
||||
|
||||
} else if (key == 'server') {
|
||||
|
||||
alert(value);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
alert(err.message);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user