Good day! Help to overcome the problem with ajax. There is such a function
function ajax_message_delete(id, zadanie_id) { $.ajax({ url: "/ajax_script/messages_window.php", type: "POST", data: 'action=delete_message&id=' + id + '&zadanie_id=' + zadanie_id, success: function (data) { if (data) { $('.infrsend').html(data); $('#center_box').slimScroll({ height:150, start : 'bottom' }) ; } } });
}
After processing, a strange addition to the result is displayed, the screen by reference.
Processing in php (and it doesn't matter what happens with the response from the server side, you can just send "1"):
if ($action == 'delete_message' && $id > 0 && $zadanie_id > 0) { //Π΅ΡΠ»ΠΈ Π°Π΄ΠΌΠΈΠ½ if($moderator['status'] == 'admin' || $moderator['funct'][13] == 1) { //q("delete from `users_messages` where `id` = '$id'"); $messages = load_messages_window(0, $zadanie_id, 1); } //* //Π΅ΡΠ»ΠΈ Π½Π΅ Π°Π΄ΠΌΠΈΠ½ else { //ΡΠ·Π½Π°Π΅ΠΌ Ρ ΠΊΠ΅ΠΌ ΠΌΡ ΠΎΠ±ΡΠ°Π»ΠΈΡΡ $q = q("select `user_to` from `users_messages` where `user_form` = '" . $_SESSION['user'][0] . "' and `id` = '$id'"); $user_to = mysql_fetch_row($q); //* q("delete from `users_messages` where `user_form` = '" . $_SESSION['user'][0] . "' and `id` = '$id'"); $messages = load_messages_window($user_to[0], $zadanie_id); } //* echo '<div class="center_box" id="center_box">' . $messages . '</div>'; }
json
format. Apparently you really got rid of the wrong piece of code that runs on the server. - lampa