Hello,
Somewhere in Internet I found a free script which I use in instant messaging system to send messages without page refreshing.
This script works well for 99% of users but from time to time I get messages from users who can't send messages because nothing happends when they click Submit button. This problem appears in Internet Explorer, even 8 version and in mobile phones.
Any ideas what can cause this problem?
Thanks.
<script type="text/javascript">
$(document).ready(function(){
$("#sendmessage").submit(function(){
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "../send.php",
data: str,
success: function(msg){
$("#note").ajaxComplete(function(event, request, settings){
if(msg == "OK")
{
result = '<div class="ok">Message sent</div>';
$("#fields").hide();
$(this).html(result);
}
else
{
result = msg;
$(this).html(result);
}
});
}
});
return false;
});
});
</script>
form:
<div id="note" class="note"><!--note--></div>
<div class="hold">
<div id="fields">
<form id="sendmessage" name="sendmessage">
<textarea name="message" rows="5" cols="30"></textarea>
<input class="button" type="submit" name="submit" value="Send" />
</div></div>