Tcalp Posted July 6, 2016 Share Posted July 6, 2016 I am looking to send some json data from an addon module, but it's being wrapped with output for the WHMCS admin console. How do I prevent that from happening ? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted July 8, 2016 Share Posted July 8, 2016 it's simple echo your json data and exit, just like that <?php function addonexample_output($vars){ $json = array("result" => "success", "message" => "Message Content"); echo json_encode($json); exit; } ?> 0 Quote Link to comment Share on other sites More sharing options...
jdsnty Posted September 4, 2021 Share Posted September 4, 2021 The answer above should be enough for most cases, but you might want to set up the HTTP headers to mark the content as a JSON as well. Just adding header('Content-Type: application/json; charset=utf-8'); to your code before echoing the JSON object (as described in sentq's comment) should do the trick. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.