在自定义的Joomla组件制造JSON Ajax响应 [英] Making JSON AJAX response in custom Joomla component

查看:262
本文介绍了在自定义的Joomla组件制造JSON Ajax响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让我的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"> 

这篇关于在自定义的Joomla组件制造JSON Ajax响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆