Try using elgg.ajax instead of $.ajax
in http://urlpetition, do
json_encode($data);
forward(REFERER);
Set what that does
Thank you for your response. I investigated this issue a few more following your advises.
The function that generates the JSON response is a page handler, so the end of this function is:
echo json_encode($json);
If I put after this echo forward(REFERER), I receive in the second install my json encoded object plus a rendered page with an error message (forward after headers sent). In my first install I receive again this type of response:
{"output":{"success":true,"q":"14 menos 12"},"status":0,"system_messages":{"error":[],"success":[]}}
But if I put after this echo die(), I just only receive my json encoded object.
I know that this should be implemented in an action instead of a page handler, but I think that could be a bug of upgrading from 1.7.X to 1.8.1.
Make sure your page handler has return true;
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.