bankera1990
Registered
Имам код който е за чат но имам проблем и той е следния.
с това <input type="checkbox" id="private" /> чеквам ако трябва да е лично съобщение към даден потребител писал в чата но проблема е че не ми го записва в таблицата.
.Js
с това се проверява дали е маркирано
проблема май идва от тук
а по този начин подава информация чрез ПОСТ
но privatе="+privatemsg+" е празно винаги как да го оправя да записва от
с това <input type="checkbox" id="private" /> чеквам ако трябва да е лично съобщение към даден потребител писал в чата но проблема е че не ми го записва в таблицата.
.Js
Код:
function loading(element){$(element).html("Зареждане...");};
function smyle(smyle){hidepanel(); var msg = $('#message').val();$('#message').val(msg+smyle);$('#message').focus();};
function msgto(login,privat){ $('#receiver').val(login);hidepanel();
if(privat == 1){
$('#private').attr('checked', true);
}else{
$('#private').attr('checked', false);}
$('#message').focus();};
function chat_list(){$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=list",success: function(html){$('#responce').html(html);}});};
function online_list(){$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=online",success: function(html){$('#whoonline').html(html);}});};
function messageform(){loading('#sendform');$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=sendform",success:
function(html){$('#sendform').html(html);}});};
function delmsg(id){loading('#sendresponce');$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=del&id="+id,success:
function(html){$('#sendresponce').html(html);var err = $('#err').val();if(err == '0'){$('#msg'+id).animate({'opacity': '0'},500);}}});};
function sendmsg(){
var privatemsg = $('#private').attr('checked');
privatemsg == true ? privatemsg = 1 : privatemsg = 0;
var receiver = $('#receiver').val();
var msg = $('#message').val();
loading('#sendresponce');$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=send&privatе="+privatemsg+"&receiver="+receiver+"&msg="+msg,success:
function(html){$('#sendresponce').html(html);var err = $('#err').val();if(err == '0'){$('#message').val('');chat_list();}}});
};
function floatpanel(){if($('#float_menu').length){if($('#float_menu').is('hidden')){$('#float_menu').animate({'opacity': 'show'},300);}else{$('#float_menu').html('зареждане...');$('#float_menu').animate({'opacity': 'hide'},300,
function(){$('#float_menu').animate({'opacity': 'show'},300);});}}else{$('body').append("<div id='float_menu'>зареждане...</div>");}var posx = parseFloat($('#posx').val()); var posy = parseFloat($('#posy').val());$('#float_menu').css({'left': (posx+15)+'px','top': (posy-10)+'px'});};
function hidepanel(){
$('#float_menu').animate({'opacity': 'hide'},300,
function(){$('#float_menu').html('')});};
function smyles(){floatpanel();
$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=smyles",success:
function(html){$('#float_menu').html(html);}});};
function useractions(login,id){floatpanel();
$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=useractions&login="+login+"&id="+id,success:
function(html){$('#float_menu').html(html);}});};
$(document).ready(
function()
{
$(document).mousemove(
function(event){$('#posx').val(event.pageX);
$('#posy').val(event.pageY);});messageform();online_list();chat_list();setInterval(
function(){chat_list();}, 3000);setInterval(
function(){online_list();}, 10000);
})
с това се проверява дали е маркирано
Код:
if(privat == 1){
$('#private').attr('checked', true);
}else{
$('#private').attr('checked', false);}
проблема май идва от тук
Код:
var privatemsg = $('#private').attr('checked');
privatemsg == true ? privatemsg = 1 : privatemsg = 0;
а по този начин подава информация чрез ПОСТ
Код:
var msg = $('#message').val();
loading('#sendresponce');$.ajax({cache: false,type: "POST",url: "ajax.php",data: "&type=send&privatе="+privatemsg+"&receiver="+receiver+"&msg="+
но privatе="+privatemsg+" е празно винаги как да го оправя да записва от
Код:
if(privat == 1){
$('#private').attr('checked', true);
}else{
$('#private').attr('checked', false);}