I have a PHP script that returns a json_encoded response that is like so:
//PHP
$response = array('type' => 'success', 'content' => '&&!%$#!some words');
echo json_encode($response);
return;
Now the JS takes the response and tries to put the content in a textarea:
$('#some_form').ajaxForm({
success: function(resp){
if(resp.type === 'success')
{
$('#text_area').val(resp.content);
}
},
dataType: 'json'
});
The content of the script will be displayed as this in the text area:
&&!%$#!some words
Why are the ampersands being messed up but not the other types of punctuation? Is there a way around this? I would like the ampersands to show up as a regular ampersand in the text area.