I have a problem with my PHP/JavaScript and accent. When I give a variable who contain an accent, the JavaScript's console say : Uncaught SyntaxError Unexpected Identifier.
PHP:
foreach($credit as $k => $v)
{
$id = $credit[$k]->id_credit;
$nom = $credit[$k]->nom_credit;
$prix = $credit[$k]->prix_credit;
echo "<a onClick='modification(".$id.",".$nom.",".$prix.");'>" . Image::resize('images/credit/' . $credit[$k]->id_credit . "." . $credit[$k]->format_image_credit,100,100) . "</a>";
}
JavaScript:
function modification(id,nom,prix)
{
var div = document.getElementById('modifCredit').style.display = 'block';
alert(id + " " + nom + " " + prix);
}
Without $nom
, all works. And If I replace :
$nom = $credit[$k]->nom_credit;
By :
$nom = "example";
I got :
Uncaught ReferenceError: example is not define.