dpbe81245 2015-12-01 16:06
浏览 24

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

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。