Controller::render() returns CakeResponse object, so try
'html' => $this->render()->body()
On Friday, October 19, 2012 2:56:44 AM UTC+2, advantage+ wrote:
--My original function to return a JSON array no longer works with v2.1.3
This worked in 1.3: loaded a form into a modal window
Controller code snip:
if ( empty( $this->data ) ) {
$this->data = $record; //debug shows the $record so there is data / debug is at 0 now
$response = array(
'status' => true,
'title' => $record['Education']['program' ],
'html' => $this->render()); }
$this->_ajaxReturn( $response ); //simply encodes and returns the $response echo json_encode($response);
But the html data is no longer being rendered into the JSON response. The fancybox loads but no HTML.
The js for the ADD link in the view calls this js:
$(".add").live('click', function (){
$.fancybox.showActivity();
$.ajax({
type: "GET",
url: $(this).attr("href"),
cache: false,
resetForm: true,
dataType: 'json',
success: function(r) {
$.fancybox({
'autoDimensions' : false,
'opacity' : 1,
'width' : 740,
'margin' : 10,
'padding' : 10,
'content' : r.html});
}
});
return false; });
The JSON response looks like this:
{"status":true,"title":"Auto Generated For Development","html_view":{}}
Any ideas?
Thanks,
Dave
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment