Languages

Menu
Sites
Language
Get values from html

       <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.

 

Edited by: 명훈 심 on 04 Mar, 2018

Responses

7 Replies
André Reus

hi 명훈 심, you may debug it on your php server to find what is the problem ... please check the value of $res and actual number of rows in the database to be sure ..... then decide ..

Marco Buettner

You send a JSON to the server? Than you have to decode your JSON on PHP file and readout the memberId value;

$postJSON = json_decode($_POST);
$id = postJSON['memberId']

 

명훈 심

I changed server's php codes to json like below.

$postJSON = json_decode($_POST);
    $memberId = postJSON['memberId'];

but don't work... and I have problem "password check". If I input "123" at memberPw and memberPw2. not correct is printed....

memberPw2.blur(function(){
       if(memberPw.val() == memberPw2.val()){
           memberPw2Comment.text('correct.');
           pwCheck2.val('1');
       }else{
           memberPw2Comment.text('not correct.');

       }
    });

Below codes are some of js code in tizen studio.

memberIdCheck.click(function(){
        console.log(memberId.val());
        $.ajax({
            type: 'post',
            dataType: 'json',
            //url: '../member/memberIdCheck.php',
            url: 'http://115.68.232.116/member/memberIdCheck.php',

            data: {memberId: memberId.val()},

            success: function (json) {
                if(json.res == 'good') {
                    console.log(json.res);
                    alert("사용가능");
                    memberIdComment.text('사용가능한 아이디 입니다.');
                    idCheck.val('1');
                }else{
                    memberIdComment.text('다른 아이디를 입력해 주세요.');
                    memberId.focus();
                }
            },
            error: function(){
              console.log('failed');
            }
        })
    });

명훈 심

When I innotate tau, "id check" and "password check" work well....

<!-- <script type="text/javascript" src="./lib/tau/mobile/js/tau.js"></script> -->
명훈 심

Ordering of "<script>" was the problem ... I think. I solved the problem. Thank you.

명훈 심

Ah.. The problems come when changing my page or using tau..;;;

André Reus

Yes you must arrange scripts according to dependency.....