drnxnbf199049 2014-01-25 09:26 采纳率: 100%
浏览 79
已采纳

在JOOMLA中接收包含`&`符号的AJAX JSON

following is my string after JSON.stringify

"chk={
    "node":"obj.1.46971",
    "user":"arslan",
    "to":"mercedes",
    "article":"<p>this my test&nbsp;</p>",
    "subject":"haha",
    "comments":"hello"
}"

I am sending it through AJAX to my JOOMLA controller

When I try to recieve chk in my JOOMLA controller it clips at & symbol and recieves only `

"chk{
    "node":"obj.1.46971",
    "user":"arslan",
    "to":"mercedes",
    "article":"<p>this my test` 

following is the line of code that I am using to receive post variables

$myJson=$app->input->get("chk","undefined",'RAW');

So how should I resolve this issue?

  • 写回答

1条回答 默认 最新

  • doushan6161 2014-01-25 09:41
    关注

    OK i just found it after making JSON use this to escape URI special chracters like ampersand

    encodeURIComponent('&')
    

    for details How can I send the "&" (ampersand) character via AJAX?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部