Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <meta name="format-detection" content="telephone=no" />
  6.         <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
  7.         <link rel="stylesheet" type="text/css" href="css/index.css" />
  8.         <title>Cadastro de Clientes</title>
  9.                 <link rel="stylesheet" href="css/jquery.mobile-1.1.2.min.css" />
  10.                
  11.                
  12.         <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  13.  
  14.  
  15.  
  16.     </head>
  17.  
  18. <body>
  19.  
  20. <center>
  21.   <p><img src="img/agrocultivo_02.jpg" width="300" height="95" /></p>
  22.   <form id="formAcesso" method="post" name="formAcesso">
  23.     <p>E-mail:
  24.       <br />
  25.       <input type="text" name="email" id="email" value="agrocultivo"/>
  26.     </p>
  27.     <p>Senha:<br />
  28.       <input type="password" name="senha" id="senha" value="agrocultivo"/>
  29.     </p>
  30.          <button type="submit" id="click" onClick="acessar()"><span>Acessar</span></button>
  31.     </p>
  32. </form>
  33.  </center>
  34. </body>
  35. </html>
  36. <script>
  37. function acessar() {
  38.        
  39. var form = $("#formAcesso").serialize();    
  40.  
  41. alert(form);
  42.  
  43.     $.ajax({
  44.                      type: 'POST',
  45.                      url: 'http://www.agrocultivo.com.br/pedidos/phonegap/acesso.php',
  46.                      crossDomain: true,
  47.                      data:  form,
  48.                      dataType: 'json',
  49.                      async: false,
  50.  
  51.                      success: function (response){
  52.                         //alert ("response");
  53.                         if (response.success) {
  54.                             alert("Logado");
  55.                              
  56.                             window.location = "area.html";
  57.                         }
  58.                         else {
  59.  
  60.                             alert("Login Falhou");
  61.                             //window.location("main.html");
  62.                         }
  63.  
  64.  
  65.                      },
  66.                      error: function(error){
  67.                          //alert(response.success);
  68.                         alert('Sem conexão ao banco de dados: ' + error);
  69.                         window.location = "index.html";
  70.                     }
  71.     });
  72.  
  73. return false;
  74. }      
  75. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement