在自定义的Joomla组件制造JSON Ajax响应自定义、组件、Ajax、Joomla

2023-09-10 21:30:17 作者:下雨的歌.

我一直试图让我的jQuery的前端和我自定义的Joomla组件之间的AJAX通信。

I am been trying to make AJAX communication between my jQuery frontend and my custom Joomla component.

我JSON响应准备好,但问题是该组件打印的HTML代替和JSON code为示出它。我不知道我做错了。

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.

先谢谢您的任何线索

推荐答案

请确保使用前端GET请求时,你已经附加参数:格式=原到您的URL请求或$。阿贾克斯({数据:格式=原始,数据类型:'json的'}),或张贴在连接了一个表单时:

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">