arslan
arslan

Reputation: 585

Recieving AJAX JSON including `&` symbol in JOOMLA

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?

Upvotes: 0

Views: 124

Answers (1)

arslan
arslan

Reputation: 585

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?

Upvotes: 1

Related Questions