I am using CakePHP and using MVC standards.
I am sending a request using ajax and need a response in the same manner as tweeter response, see tweeter sample response below.
Like tweeter sends:
{
"user_id":"155dsfds95",
"html":" \u003Cdiv class=\"module profile-card component profile-header\" data-component-term=\"profile_follow_card\" \u003E\n ",
"screen_name":"abc"
}
I need to send user_id and screen_name from controller and html content from view.
my response data is as follow:
$response['user_id'] = $id;
$response['screen_name'] = 'some_name';
As of now I can send user_id and screen_name as json_encode($response)
But how do I send view content also in data index with the response?
UPDATES
I do not want to make html content in controller, rather it should come from view.