drnxnbf199049 2014-01-25 17: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 17: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?

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

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog