- Updated JS and PHP egw_json code

- Added array_stripslashes() to common_functions.inc.php
- Added json handler (json.php)
This commit is contained in:
Andreas Stöckel
2010-06-01 14:20:55 +00:00
parent 2bbe2e1203
commit 0c243b49a3
4 changed files with 205 additions and 22 deletions

View File

@@ -51,10 +51,9 @@ egw_json_request.prototype.sendRequest = function(_async, _callback, _sender)
//Assemble the actual request string
var request = '{';
request += '"request":{';
request += '"menuaction":"' + this.menuaction + '"';
if (this.parameters)
{
request += ',"parameters":[';
request += '"parameters":[';
for (var i = 0; i < this.parameters.length; i++)
{
if (i > 0)
@@ -71,7 +70,7 @@ egw_json_request.prototype.sendRequest = function(_async, _callback, _sender)
request_obj.json_data = request;
//Send the request via the jquery AJAX interface to the server
$.ajax({url: this.url,
$.ajax({url: this.url + '?menuaction=' + this.menuaction,
async: is_async,
context: this,
data: request_obj,
@@ -122,7 +121,10 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
break;
case 'data':
//Callback the caller in order to allow him to handle the data
this.callback.call(this.sender, data.response[i].data);
if (this.callback)
{
this.callback.call(this.sender, data.response[i].data);
}
hasResponse = true;
break;
case 'script':