Friday, 9 October 2015

Index

<!DOCTYPE html>
<html>
    <head>
        <!--
        Customize this policy to fit your own app's needs. For more guidance, see:
            https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
        Some notes:
            * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
            * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
            * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
                * Enable inline JS: add 'unsafe-inline' to default-src
        -->
        <meta http-equiv="Content-Security-Policy" content="default-src *; script-src * 'unsafe-eval' 'unsafe-inline'; connect-src *; img-src *; style-src * 'unsafe-inline' ; media-src *;">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
   


        <title>Hello World</title>
    </head>
    <body>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script type="text/javascript">


            $(document).ready(function(){
                //$.support.cors = true;

                        var $username = $("#email");
                        var $password = $("#pass");
                       

                $("#submit").on('click', function(){
                    $.ajax({
                        type: 'POST',
                        crossDomain: true,

                        url: 'http://10.11.18.88:8080/punebook/Login',

                        data: JSON.stringify( {username: $username.val(), password: $password.val()}),
                        //data: "{'username': "+$username.val()+", 'password': "+$password.val()+" }",
                        success: function(data){

                            var arr = JSON.parse(data);
                            if(arr.Status== "true")
                            {
                                alert("You have successfully logged in!");
                                localStorage.setItem('s_uid', arr.s_uid);
                                location.href="newsfeed.html";
                            }

                            else if(arr.status == "false")
                            {    alert("Logged in attempt failed!");
                              }

                           
                        },

                        error: function(err){
                            console.log("error data",err);
                            alert("Connection Failed");
                        }
                    });
                });  

            //return false;
            });
                    </script>
   
       
        <div class="app"><br>
            <h1>PuneBook</h1><br><br>
        <input type="email" id="email"  placeholder="Email" required><br><br>
        <input type="password" id="pass" placeholder="Password" required><br><br>
        <input type="button" id="submit" value="Login"></input>
        <a href="newsfeed.html">Go to next page</a>
       

 
        <!-- <script type="text/javascript" src="cordova.js"></script> -->
        <script type="text/javascript" src="js/index.js"></script>
    </body>
</html>

No comments:

Post a Comment