Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/05/2015, 08:11
Avatar de enlinea777
enlinea777
 
Fecha de Ingreso: mayo-2008
Ubicación: frente al pc
Mensajes: 1.830
Antigüedad: 16 años
Puntos: 127
Respuesta: Envio con across domain CORS

estoy viendo tu codigo en lugar de POST tienes un GET

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  3.     <script src="https://code.jquery.com/jquery-2.1.3.js"></script>
  4.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>    
  5.     <title></title>
  6. </head>
  7.     <input type="text" id="log_id">
  8.     <input type="text" id="log_pass">
  9.   <button id="go">Enviar</button>
  10.  <script> alert(document.cookie);</script>
  11. </body>
  12. </html>
  13.  
  14.     $(document).ready(function(){
  15.        $("#go").on('click',function(){        
  16.          var id = $("#log_id").val();
  17.          var pass = $("#log_pass").val();
  18.          if(id.length > 0 && pass.length > 0){
  19.           $.ajax({
  20.             type:"GET",
  21.             dataType: 'jsonp',
  22.             crossDomain: true,
  23.             url: "http://envioporpost.esy.es/verificar.php?jsoncallback=?",
  24.             jsonpCallback: 'jsonCallback',
  25.             data:"user="+id+"&pass="+pass,
  26.             success:function(data){
  27.              // data = JSON.parse(data);
  28.                console.log(data.users);
  29.                console.log(data.passw);
  30.                var myDate = new Date();
  31.                myDate.setMonth(myDate.getMonth() + 12);
  32.                document.cookie = "user_da=" + data.users + ";expires=" + myDate
  33.                   +";domain=.http://envioporpost.esy.es;path=/";
  34.                document.cookie = "pass=" + data.passw + ";expires=" + myDate
  35.                   +";domain=.http://envioporpost.esy.es;path=/";
  36.              // var nomb = localStorage.getItem("users_d");
  37.              // var passd = localStorage.getItem("pass_d");
  38.               window.location.href = "http://envioporpost.esy.es";
  39.                
  40.              },
  41.              xhrFields: {
  42.               withCredentials: true
  43.              },
  44.              statusCode: {
  45.               404: function() {
  46.                 console.log( "page not found" );
  47.               },
  48.               200: function() {
  49.                 console.log( "encontrado" );
  50.               }
  51.              },
  52.              error:function(jqXHR, status, error){
  53.                 console.log(status + '; ' + error);
  54.              }      
  55.            });
  56.          }
  57.         });
  58.     });
  59.