I've read this thread to reenable preventDefault() on submit method. But that did not work on my case. I tried to use $(this).unbind('submit').submit()
to enable it again. I put it inside POST method and before JQuery Colorbox dialog opened. Inside that dialog, there's also a submit button, but the button cannot be clicked too. So I have to reenable preventDefault(), so that the button can be clicked.
$("#Username, #Password").keypress(function(e){
if (e.which == 13 ) {
$("form:first").submit(function(e){
e.preventDefault(); //interrupt submit process
var userdata = {username : $("#Username").val() };
$.ajax({
type: 'POST',
url: 'http://localhost/test/test.php',
data: userdata,
success: function(data){
if(data==0){
$(this).unbind('submit').submit(); //enable it again(but it didn't worked!)
$.fn.colorbox({width:"50%", inline:true, href:"#reminder_dialog" })} //JQuery Colorbox opened.
else {
$(this).submit();
}
},
async:false
});
});
}
});
I also already tried to use $(this).trigger('submit')
and $(this).get(0).allowDefault = true
, but those also didn't work.