当我点击提示按钮时,我正在进行ajax调用,显示错误
typeerror 'step up' called on an object that does not implement interface htmlinputelement
我的ajax代码是
$('form#login, form#register').on('submit', function (e) {
//if (!$(this).valid()) return false;
$('p.status', this).removeClass('owner-fail');
$('p.status', this).removeClass('owner-success');
$('p.status', this).show().text(ajax_auth_object.loadingmessage);
username = $('form#login #username').val();
password = $('form#login #password').val();
security = $('form#login #security').val();
email = '';
if ($(this).attr('id') == 'register') {
action = 'ajaxregister';
username = $('form#register #username').val();
contact = $('form#register #contact').val();
fname = $('form#register #fname').val();
lname = $('form#register #lname').val();
email = $('form#register #email').val();
security = $('form#register #signonsecurity').val();
}
ctrl = $(this);
$.ajax({
type: 'POST',
dataType: 'json',
url: ajax_auth_object.ajaxurl,
data: {action: action,username: username,fname: fname,lname: lname,password: password,contact: contact,email: email,security: security},
success: function (data) {
if(data.loggedin == true || data.loggedin== false )
$('p.status', ctrl).addClass(data.class);
$('p.status', ctrl).text(data.message);
if (data.loggedin == true && data.success== true) {
document.location.href = ajax_auth_object.redirecturl;
}else if(data.loggedin == true)
$('#register input').val('');
$('p.status', ctrl).delay(7000).fadeOut(400);
}
});
e.preventDefault();
});
我使用相同的ajax进行注册和登录,事情是它完全适用于注册而不是登录 我的网址是那个 http://property.stw-services.com/add-place/
奇怪的是,首先,如果我曾经尝试过注册它将适用于注册然后尝试登录然后将完美地工作,但在页面加载第一次后我尝试登录它不工作
答案 0 :(得分:0)
哦对不起我的不好,我正在传递额外的数据参数,但是这不是通过登录发送所以添加刚刚传递的联系人,lname和fname的空白参数,就像这样
action = 'ajaxlogin';
username = $('form#login #username').val();
password = $('form#login #password').val();
security = $('form#login #security').val();
email = '';
contact = '';
fname = '';
lname = '';