1
Come on, guys.
I have a code that brings a setInterval of messages passed between users de
and para
in the function below..
function openWidChat(de,para) {
var url_s = $("#url_s").val();
$("label#boxC input").val('');
$("label#boxC input").removeAttr('disabled');
$("label#boxC input").attr('user-de',de);
$("label#boxC input").attr('user-para',para);
$("#mensChat div._5chat").fadeIn(400).html('<div class="maxWid_16"><img src="'+ url_s +'/themes/4space/images/load/loadLikesW.gif" alt="" width="16" height="16"></div>');
para = setInterval(function() {
$.ajax({
url: url_s +"/demo/chat/chat.php",
data:'d='+de+'&p='+para+'&url_s='+url_s,
type: "POST",
cache: false,
success : function(html){
$("#mensChat div._5chat").html(html);
}
});
}, 1000);
}
until then it works fine, but when I click on a name of another user to start in the same box a new conversation setInterval
keeps going back and forth on all the users that I clicked to talk to... It gets a hell of a lot..
Someone has a solution to this?
A problem, you have the parameter
para
and a variablepara
. That’s trouble because you’re usingpara
in the Ajax call. In addition, you should start the variablepara
withvar para ...
. I suggest that different names between the parameter and the variable.– Zuul