Skip to content

Commit

Permalink
Ajax now returns arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepwinter committed May 6, 2011
1 parent 88610f0 commit 8977d02
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions modules/mopcore/classes/controller/ajax.php
Expand Up @@ -22,6 +22,7 @@ public function action_handleRequest($uri){
public function action_data($uri)
{
//request to child, just data
$arguments = explode('/', $uri);

try {
$subRequest = Request::Factory($uri);
Expand All @@ -31,22 +32,26 @@ public function action_data($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
'response' => $message
'response' => $message,
'arguments'=>$arguments

);
$this->response->body(json_encode($ajaxResponse));
return;
}
$ajaxResponse = array(
'returnValue' => TRUE,
'response'=>$data
'response'=>$data,
'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}

public function action_html($uri)
{

$arguments = explode('/', $uri);

try {
$subRequest = Request::Factory($uri);
$html = $subRequest->execute()->data();
Expand All @@ -55,7 +60,8 @@ public function action_html($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
'response' => $message
'response' => $message,
'arguments'=>$arguments

);
$this->response->body(json_encode($ajaxResponse));
Expand Down Expand Up @@ -87,12 +93,15 @@ public function action_html($uri)
'css'=>$cssResources
),
'returnValue' => TRUE,
'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}

public function action_compound($uri)
{
$arguments = explode('/', $uri);

try {
$subRequest = Request::Factory($uri);
$requestResponse = $subRequest->execute();
Expand All @@ -101,8 +110,8 @@ public function action_compound($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
'response' => $message

'response' => $message,
'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
return;
Expand Down Expand Up @@ -134,7 +143,8 @@ public function action_compound($uri)
);
$ajaxResponse = array(
'returnValue' => TRUE,
'response'=>$compoundResponse
'response'=>$compoundResponse,
'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}
Expand Down

0 comments on commit 8977d02

Please sign in to comment.