How to avoid this attitude?!

How to avoid this attitude?!

Hi,

I have a sign in form wit ajax as per below code but sometimes it doesn't work and it just goes to this URL:


It is is not frequently happening, maybe once or twice a week only... I am not sure why and when exactly it occurs.but I want to avoid it.

here is the code:

  1. $("#frmSignin").validate({
  2. rules:
  3. {
  4. txtUserID: { required: true },
  5. txtPassword: { required: true }
  6. },
  7. submitHandler: function (form)
  8. {
  9. $.ajax({
  10. type: 'POST',
  11. url: "signin.php",
  12. data: $('#frmSignin').serialize(),
  13. beforeSend: function()
  14. {
  15. $("#btnSignin").parent().hide();
  16. $("#divUserID").hide();
  17. $("#divPassword").hide();
  18. $.mobile.loading('show', {theme:"b", text:"Please wait..", textonly: false, textVisible: true});
  19. },
  20. success: function(data)
  21. {
  22. if (data.match(/true/))
  23. {
  24. $.mobile.changePage('my.php', { reloadPage: true, transition: "flow"} );
  25. }
  26. else
  27. {
  28. $.mobile.loading('hide');
  29. $('#InvalidUserIDPassword').popup();
  30. $("#InvalidUserIDPassword").popup("open"); 

  31. $('#txtUserID').val("");
  32. $('#txtPassword').val("");
  33. $("#btnSignin").parent().show();
  34. }
  35. },
  36. error: function(jq, status, message)
  37. {
  38. alert('A jQuery error has occurred. Status: ' + status + ' - Message: ' + message);
  39. }
  40. });
  41. }
  42. });