在Ajax调用期间,表单数据头分为单个字符

时间:2015-12-01 16:06:31

标签: php ajax forms http-headers

当我检查ajax调用发送的表单数据头时,我在图像中有结果是否正常? 我觉得很奇怪的是,表单数据中的每个字符都是单独发送的。例如,有userName: Sirius

0: u   
1: s   
2: e   
3: r   
4: N    

依旧......
这是link。 这是正常的行为吗?

这是我的代码:

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();
                    });
                }
            });
        }
    });
});

数据记录(在注释行上)提供了通常的表单数据内容:

userName=dhnbrthy&userPassword=ebthyveyhe&action=wpjobusLoginForm&wpjobusLogin_nonce=14e168813a&_wp_http_referer=%2Fwpjobus%2Flogin%2F&submit=Login   

没有分割所有字符

0 个答案:

没有答案