Erreur : X is not a function (evaluating 'Y(n)')
Salut, aidez moi s'il vous plait, je ne comprends pas mon erreur :weird:
Citation:
[Error] TypeError: Conversation verrouillée is not a function (evaluating 'alerted(n)')
(anonymous function)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| function send(message){
var alerted = msg;
document.getElementById('alertid').innerHTML += '<div class="mp_alert_box" id="alertbox'+num+'"><img src="img_mp/online.png" style="height:20px;width:20px;"> '+msg+' </div>';
var n = num;
alert('msg : '+msg+' n : '+n+' ');
setTimeout(function(){ alerted(n)}, 3000);
num++;
$.ajax({
type: 'POST',
url: 'chatmsg.php',
data: {alerted: alerted},
success: function(e) {}
});
} |
Appelée grâce à :
Code:
<img onClick="send('Conversation verrouillée')" src="img_mp/lock.png"/>
Résultat ma boîte "mp_alert_box" s'affiche mais alerted(n) qui est sensée la supprimer ne le fait pas.