JQuery ajax實現

//登錄
    $('#btnlogin').bind('click',function () {
    //獲取參數
        $phone = $('#txtPhone').val();
        $password = $('#txtPassword').val();
        console.log($phone);
        console.log($password);
        $.ajax({
            type:'POST',
            url:'http://192.168.7.100/htmlprojectwebapi/account/login',
            //參數
            data:{phone:$phone,password:$password},
            success:function (res) {
                console.log(res);
                if(res.Code == 100){
                    location.href='index.html';
                }else{
                    alert('用戶名或密碼不正確!')
                }
            }
        });
    });
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章