gpt4 book ai didi

php - Ajax 登录不适用于输入键

转载 作者:搜寻专家 更新时间:2023-10-31 20:44:00 26 4
gpt4 key购买 nike

<分区>

我有一个在 ajax 上工作的 PHP 登录表单,当我点击登录按钮时它工作得很好,但在按下回车键时却没有。

我对此进行了大量研究,并尝试了本网站上发布的所有解决方案,并尝试了所有解决方案,但对我来说没有任何效果。

我的 HTML 包裹在一个 div id ="mini-login"

<div class="content-login">
<h4>Email Address:</h4>
<input type="text" name="email" value="" />
<h4>Password:</h4>
<input type="password" name="password" value="" id="pasword"/>
<br />
<a href="<?php echo $forgotten; ?>"><?php echo $text_forgotten; ?></a><br />
<br />
<input type="button" value="<?php echo $button_login; ?>" id="button-login-mini" class="button" />

还有我的脚本-

$('#button-login-mini').live('click', function() {
$.ajax({
url: 'index.php?route=module/login/validate',
type: 'post',
data: $('#mini-login .content-login :input'),
dataType: 'json',
beforeSend: function() {
$('#button-login-mini').attr('disabled', true);
$('#button-login-mini').after('<span class="wait">Please wait</span>');
},
complete: function() {
$('#button-login-mini').attr('disabled', false);
$('.wait').remove();
},
success: function(json) {
$('.warning, .error').remove();
if (json['redirect']) {
$('#mini-login .content-login').fadeOut('slow');
location = json['redirect'];
} else if (json['error']) {
$('#mini-login .content-login').prepend('<div class="warning" style="display: none;">' + json['error']['warning'] + '</div>');

$('.warning').fadeIn('slow');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});

上面的代码运行良好,但我尝试使用 keyup、keydown、keypress 调用它并检查 keyCode==13,但它没有用,也尝试使用表单,现在变得疯狂在这之上!我究竟做错了什么??以及如何让它发挥作用??

注意:登录页面不是一个完整的文档,它是在首页点击登录链接后向下滑动的。

登录页面是这样调用的-

$(document).ready(function() {
$('#mini-login > .heading-login a').live('click', function() {
$('#mini-login').addClass('active');

$('#mini-login').load('index.php?route=module/login #mini-login > *');

$('#mini-login').live('mouseleave', function() {
$(this).removeClass('active');
});
});
});

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com