Making JSON AJAX response in custom Joomla component

自闭症网瘾萝莉.ら 提交于 2019-12-11 13:43:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!