I have a problem with json encoded information which loaded via ajax.
The PHP code (test.php):
<?php
$val1 = 'Productmanager m / f';
$val2 = 'test';
$arr = array('first' => $val1, 'second' => $val2);
echo json_encode($arr);
?>
The JavaScript code inside a html file:
$(document).ready(function() {
$.post("test.php", function(data){
var response = $.parseJSON(data);
console.log(response.first);
console.log(response.second);
}
});
And the result in console looks like:
Productmanager m / f
and
test
Both files are UTF-8 encodet.
I´m realy dont know why and how to convert it back to a readable string. You may have an idea how this can occur?
I have found no suitable solution at first go, just search&replace approaches.