使用JavaScript对文本文件进行验证

使用JavaScript对文本文件进行验证,javascript,php,verification,Javascript,Php,Verification,我正在寻找使用文本文件的简单验证 Text: ABC5864 例如: Text: ABC5864 verification.txt Text: ABC5864 根据用户输入,如果正确,则允许登录,否则显示错误消息: Text: ABC5864 <input name="myverification" id="myverification" type="verification" class="form-control" placeholder="verification">

我正在寻找使用文本文件的简单验证

Text: ABC5864
例如:

Text: ABC5864
verification.txt

Text: ABC5864
根据用户输入,如果正确,则允许登录,否则显示错误消息:

Text: ABC5864
<input name="myverification" id="myverification" type="verification" class="form-control" placeholder="verification">

这是我的密码:

Text: ABC5864
$(文档).ready(函数(){
“严格使用”;
$(“#提交”)。单击(函数(){
var username=$(“#myusername”).val(),password=$(“#mypassword”).val();
如果((用户名==)| |(密码==)){
$(“#message”).html(“×;请输入用户名和密码”);
}否则{
$.ajax({
类型:“POST”,
url:“checklogin.php”,
数据:“myusername=“+username+”&mypassword=“+password,
数据类型:“JSON”,
成功:函数(html){
//console.log(html.response+''+html.username);
如果(html.response=='true'){
//location.assign(“../index.php”);
location.reload();
返回html.username;
}否则{
$(“#message”).html(html.response);
}
},
错误:函数(textStatus,errorshown){
console.log(textStatus);
console.log(错误抛出);
},
beforeSend:函数(){
$(“#message”).html(“

”);
Text: ABC5864
} }); } 返回false; }); });

请登录
登录
试试这个

Text: ABC5864
  function checkInput(input_id) {
        input_value = jQuery('#' + input_id).val();
        if ((input_value == "") || (input_value == null)) {
            jQuery('#' + input_id + '_error').html('Please fill in
!');
            return 0;
        } else {
            jQuery('#' + input_id + '_error').html('');
            return 1;
        }

    }