function nextPhoto() { jQuery.ajax({url: "/guess_the_group/workphoto.php", dataType: "html", type: "GET", success: function(msg) { //alert(""); document.getElementById('photoband').innerHTML = msg; }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert('Ошибка'); } }); } $(document).ready(function () { $("#PhotoForm").submit(function () { var str = $(this).serialize(); $.ajax( { type: "POST", url: "/guess_the_group/guess_group.php", data: str, success: function (msg) { $("#note").ajaxComplete(function (event, request, settings) { if (msg == 'OK') // Если сообщение отправлено, поблагодарим пользователя { result = '<div id="notification_ok">Угадал, наглый :)</div>'; } else { result = msg; } $(this).html(result); }); } }); return false; }); }); By the form I send the data to the php script, and get an answer if the answer is correct - one action, if not - another. When I click on the nextphoto button, the form on the Ajax stops working. Pkhp stupidly opens with a response. What can be wrong?
UPD: And here's another question, I made sure that if the answer is correct, the send button was removed.
result = 'Угадал, наглый хорек :)'; $("#otp").hide('slow'); But now, when you click nextPhoto , the button is still removed. Although the answer has not yet been.