Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function ajaxHandleError()
{
alert('Transfer error, please reload the page or try again later.');
}
function ajaxShowError( string )
{
$('#ajaxError').html(string).show();
}
function ajaxHideError()
{
$('#ajaxError').hide();
}
function ajaxToggleLoading()
{
$('#ajaxLoading').toggle();
}
function ajaxHandleResponse(response)
{
if(response.result == "error")
{
ajaxShowError(response.message);
}
else
{
window.location.reload();
}
ajaxToggleLoading();
}
function toggleAjaxLoading()
{
$('#ajaxLoading').toggle();
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
function getStandardAjaxConf()
{
var ajaxRequest = new Object;
//prepare the ajax request
ajaxRequest.type = 'GET';
ajaxRequest.url = 'index.php';
ajaxRequest.dataType = 'json';
ajaxRequest.error = ajaxHandleError;
ajaxRequest.success = ajaxHandleResponse;
return ajaxRequest;
}