Login validation not happening using ajax and json
<p>When i log in, it has to first check if the entered username and password matches the data present in the json file. 
This is not happening. It logs in at every enetered username and password. Please let me know where i have gone wrong.  </p>

<p>This is the index.html</p>

<pre><code>            &lt;!DOCTYPE html&gt;
            &lt;html&gt;

            &lt;head&gt;

                &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
                &lt;meta charset="utf-8" /&gt;
                &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"&gt;
                &lt;link rel="stylesheet" href="css/Screen1.css"&gt;
                &lt;script type = "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
                &lt;script type = "text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.2.8/jquery.form-validator.min.js"&gt;&lt;/script&gt;
            &lt;!--    &lt;script type="text/javascript" src="js/Validation.js"&gt;&lt;/script&gt;
             --&gt;    &lt;script type="text/javascript" src="js/AccountAuthentication.js"&gt;&lt;/script&gt;


            enter code here
                &lt;script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"&gt;&lt;/script&gt;

            &lt;/head&gt;


            &lt;body&gt;
                &lt;div data-role="page" id=""&gt;
                    &lt;div data-role="header" class="ui-bar-a ui-page-theme-a ui-bar-inherit"&gt;
                        &lt;h1&gt;Login&lt;/h1&gt;
                    &lt;/div&gt;
                    &lt;div data-role="main" class="ui-content"&gt;

                    &lt;form id="UserLogin" class="ui-body ui-corner-all" data-ajax="false" method="get" action="HomePage.html"&gt; 
                        &lt;div data-role="fieldcontain"&gt;
                            &lt;input type="text" name="uname" placeholder="Email address" id="uname" value=""/&gt;
                        &lt;/div&gt;  
                        &lt;div data-role="fieldcontain"&gt;
                            &lt;input type="password" name="password" placeholder="Password" id="password" value="" /&gt;
                        &lt;/div&gt;
                        &lt;input type="submit" class="ui-btn ui-btn-inline ui-corner-all ui-shadow" name="submit" id="submit" value="Log In"/&gt;

                        &lt;!-- &lt;a href="HomePage.html" class="ui-btn ui-btn-inline ui-corner-all ui-shadow" id="submit" data-ajax="false"&gt;Submit&lt;/a&gt; --&gt;
                        &lt;a href="Register.html" class="ui-btn ui-btn-inline ui-corner-all ui-shadow "&gt;Register&lt;/a&gt;
                    &lt;/form&gt; 
                    &lt;/div&gt;
                    &lt;div data-role="footer" class="ui-bar-a ui-page-theme-a ui-bar-inherit" data-position="fixed"&gt;
                        &lt;h6&gt;2016&lt;/h6&gt;
                    &lt;/div&gt;
                &lt;/div&gt;


            &lt;/body&gt;

            &lt;/html&gt;

    AccountAuthentication.js

    $(document).ready(function(){

        $("#submit").click(function(){

        var uname = $('#uname').val();  
        var password = $('#password').val();
        console.log("this is from form: "+uname);
        console.log("this is from form: "+password);
        alert(uname);
                $.ajax({
                    type:"GET",
                    dataType:"json",
                    url:"json/validate.json", 
                    success: function(data) {   
                        alert("inside success");
                        $.each(data, function (key, value) {
                        console.log(value.uname);
                            if (value.uname != '' &amp;&amp; value.password!='')
                                {
                                    if(value.uname!=uname &amp;&amp; value.password!=password)
                                    alert("password correct");
                                    return false;
                                }
                        });


                    },
                    error: function() {

                    }
               });


    });

    });

    validation.js

     {
            "uname": "pooja",
            "password": "1234"

        }
</code></pre>