I am using the ajax uploader and the Zend Framework.
The Problem is when I am using the json response for the onSubmit.
With $this->getHelper('Json')->sendJson($data);
I only get a saveas dialog.
The problem is that the uploader expects every responste to be "text/html" but the json helper sends "application/json" as mimetype.
With a usual response every thing works fine, but I need to send some information back to the script.
So how can I say Zend that it should send jsondata with the mimetype "text/html"?
You can affect the response by using the response object. From within your controller:
$content = Zend_Json::encode(array('Foo' => 'Nice', 'Bar' => 'Vice'));
$this->getResponse()
->setHeader('Content-Type', 'text/html')
->setBody($content)
->sendResponse();
exit();
Yet another variant
echo Zend_Json::encode(array('result' => true));
exit;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With