Sunt mai in nou in ale acestui limbaj si sper ca ma puteti ajuta. Ce am gasit pe net nu prea a facut asta...
Am incercat sa fac un "fel de sistem" de mesaje sa spun asa...
Cod: Selectaţi tot
$('#reply #send').click(function() {
var message = $(this).parent().find('.textbox').val();
var mid = $(this).attr('mid');
var sender = $(this).attr('sender');
$.post('ajax/answer.php', { 'mid': mid, 'message': message, 'sender': sender }, function(data) {
if (data.length != 0)
{
$('#reply .textbox').val('');
var old_html = $('#messages').html();
var new_html = old_html + data;
$('#messages').html(new_html);
}
});
return false;
});
dar ce ar trebui sa imi returneze codul din fisierul .php pentru a se efectua if- ul ( / un refresh) ?
answer.php :
Cod: Selectaţi tot
<?PHP
require_once '../inc/database.php';
$sender = $_POST["sender"];
$message = $_POST["message"];
$subiect = $_POST["mid"];
$addmsj = $sqlServ->query("INSERT INTO account.mesaje (sender , idsub , mesaj ,msdata) VALUES ('".$sender."' , '".$subiect."' , '".$message."' , NOW() )");
?>
Nu prea vreau sa folosesc
Cod: Selectaţi tot
$("#messagesend").load(" #messagesend");
Imi cer scuze in cazul in care subiectul nu se potrivea in aceasta sectiune .