Hey.

If you're going to do PUTs and POSTs and whatever != GET to the server,
you also need to add a

header('Access-Control-Allow-Methods: POST,PUT, GET, OPTIONS, DELETE');

a to your server. Change the method list to what you're really using, of
course. OPTIONS is required though,
since when you do a POST or PUT or DELETE the browser sends first an
OPTIONS to the server to ask if it's
allowed to send the POST/PUT/whatever.

Best regards,

Antonio


On 01/08/2013 9:45, Flaki wrote:
Hi!

That isn't a very lengthy description. What do you mean "not able to send"? 
Where does the request fail? Have you tried debugging via dev tools/console/network tab 
etc.?

The CORS headers seams okay, but are you sure it actually is present in the 
response (console -> network tab again, inspect the headers of the request) - 
it might be possible that headers are already sent when you try to set the CORS 
header and it fails.

Please try to be more elaborate next time you are asking for help or 
experiencing an issue - as most of us (afaik) are not really in possession of 
clairvoyant powers - we can only build off of what you share with us. :)

Cheers
Flaki


On Tuesday, July 23, 2013 6:38:36 PM UTC, jose llopis wrote:
hi i 've recently got a zte open and im not able to send a cross domain ajax 
transaction with this code on

client

$.ajax({
          url:"http://192.168.1.4/webappServer/login.php";,
          type:"POST",
          data: {
             user: $("#txtU").val(),
             pass: $("#txtP").val()
         },
          success:function(data){
             if(data!=-1)
             {
                 data=$.parseJSON(data);
                 sessionStorage.setItem("loginID",data.id);
                 sessionStorage.setItem("nick",data.nick);
                 location.href="app.html";
             }
             else
             {
                 alert("error");
             }
          }
     });

Login php has

this header

header('Access-Control-Allow-Origin: *');

any idea?
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g


________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar 
nuestra política de envío y recepción de correo electrónico en el enlace 
situado más abajo.
This message is intended exclusively for its addressee. We only send and 
receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to