Is it normal that I have the results in the image when I inspect form data header sent by an ajax call?
What I find strange is that every single character in form data is sent alone. for example there is userName: Sirius
and
0: u
1: s
2: e
3: r
4: N
and so on...
This is the link.
Is it a normal behaviour??
This is my code:
jQuery(function($) {
jQuery('#wpjob-register').validate({
rules: {
userName: {
required: true,
minlength: 3
},
userPassword: {
required: true,
minlength: 1,
}
},
messages: {
userName: {
required: "Inserisci una username",
minlength: "La username deve essere almeno di 3 caratteri"
},
userPassword: {
required: "Inserisci una password",
minlength: "La password deve essere almeno di 6 caratteri"
}
},
submitHandler: function(form) {
console.log(jQuery(form).serialize()); //logging for debug!
jQuery('#wpjob-register .input-submit').css('display','none');
jQuery('#wpjob-register .submit-loading').css('display','inline-block');
jQuery(form).ajaxSubmit({
type: "POST",
data: jQuery(form).serialize(),
url: 'http://localhost/wpjob/wp-admin/admin-ajax.php',
success: function(data) {
if(data == 1) {
jQuery("#userName").addClass("error");
jQuery(".userNameError").text("Username doesn’t exists. Please try another one.");
}
if(data == 2) {
jQuery("#userPassword").addClass("error");
jQuery(".userPasswordError").text("Password doesn’t exists. Please try another one.");
}
},
error: function(data) {
jQuery('#wpjob-register').fadeTo( "slow", 0, function() {
jQuery('#error').fadeIn();
});
}
});
}
});
});
Data logging (on the commented line) gives an usual form data content:
userName=dhnbrthy&userPassword=ebthyveyhe&action=wpjobusLoginForm&wpjobusLogin_nonce=14e168813a&_wp_http_referer=%2Fwpjobus%2Flogin%2F&submit=Login
without all the characters split