问题
I am been trying to make AJAX communication between my jQuery frontend and my custom Joomla component.
My JSON response is ready but the problem is that the component prints HTML instead and the JSON code is shown in it. I have no idea what I am doing wrong.
Thanks in advance for any clues
回答1:
Make sure when using GET request in the frontend, you've attached param: format=raw to your URL request or $.ajax({ data : 'format=raw', dataType: 'json' }), or when posting a form you have attached:
<input type="hidden" name="format" value="raw">
来源:https://stackoverflow.com/questions/6318610/making-json-ajax-response-in-custom-joomla-component