OllyBarca
OllyBarca

Reputation: 1531

JQuery and AJAX $.post() function

I have this function that I was helped to create with one of my Uni professors. It checks the length of the password by parsing the value of the #txtNewPassword field to a 'checkpasslength.php' file, which processes the data and returns a value based on the length/contents of the data in the $.post()....The only part I don't understand is the second parameter of the $.post() function...what does the reg.password.value do exactly? I know pretty much what it does (sends the value within the form on each keypress), but what does the .reg mean?

$(document).ready(function() {
    $('#checkPassLength').load('checkpasslength.php').show();

    $('#txtNewPassword').keyup(function() {
        $.post('checkpasslength.php', {password: reg.password.value}, 
        function(result) {
            $('#checkPassLength').html(result).show();
        });
    });
});

Upvotes: 0

Views: 41

Answers (1)

whyte624
whyte624

Reputation: 330

The second parameter {password: reg.password.value} is actual password value. reg.password.value means form_name.field_name.value.

Upvotes: 1

Related Questions