Zmieniałem zmiennie tutaj na forum, w skrypcie mam takie same.
Dalej czegoś tu nie łapie.
Mam prosty skrypt shoutboxa, funkcje. Wysyłanie wiadomości:
function chat_send(last_shout_time, chat_shout) {
var btime = new Date();
var btime_now = btime.getTime();
if (last_shout_time < btime_now) {
alert('Odczekaj chwile');
}
else {
if (chat_shout.trim() != '') {
var atime = new Date();
var atime_now = atime.getTime()+3000;
last_shout_time = atime_now;
$.ajax({
type: "POST",
url: "send.php",
data: "chat_shout="+chat_shout,
success: function(data) {
get_shouts();
last_shout_id++;
}
});
$('input[name="chat_shout_msg"]').val('');
}
}
}
i:
$(document).ready(function(){
function now_time() {
var time = new Date();
var time_now = time.getTime();
return time_now;
}
$("#send").submit(function(){
var last_shout_time = now_time();
chat_send(last_shout_time, chat_shout);
return false;
});
No i to co tutaj pokazałem, tak wygląda w praktyce. Nie działa, tzn nigdy nie pokazuje okienka "Odczekaj". Co więc robię źle?