Get values from html

Get values from html

BY 04 Mar 2018 Web Application Development

       <div class=”line”>
                <p>PW</p>
                <div class=”inputArea”>
                    <input type=”password” name=”memberPw” class=”memberPw” />
                </div>
            </div>
            <div class=”line”>
                <p>PW confirm</p>
                <div class=”inputArea”>
                    <input type=”password” name=”memberPw2″ class=”memberPw2″  />
                    <div class=”memberPw2Comment comment”></div>
                </div>
            </div>

 

    var memberPw = $(‘.memberPw’);
    var memberPw2 = $(‘.memberPw2’);
    var memberPw2Comment = $(‘.memberPw2Comment’);

memberIdCheck.click(function(){
        console.log(memberId.val());
        $.ajax({
            type: ‘post’,
            dataType: ‘json’, 
            url: ‘http://IP/member/memberIdCheck.php’,
            data: {memberId: memberId.val()}, 

            success: function (json) {
                if(json.res == ‘good’) {
                    console.log(json.res);
                    memberIdComment.text(‘you can use this ID.’);
                    idCheck.val(‘1’);
                }else{
                    memberIdComment.text(‘you can’t use this ID.’);
                    memberId.focus();
                }
            },

            error: function(){
              console.log(‘failed’);

            }
        })
    });

 

I input password “123” into memberPw1, 2 “password wrong.” is printed.

And I input ID “1234” that is alreay exist in DB server, “you can use this ID.” is printed

In chome browser those functions works well.

What is the problem??

 

Idcheck.php

If I input “1234” php have to send ‘red’=>’bad’ to phone. And it must be printed “you can’t use this ID.“. But it’s not.

 

Written by