1

I wrote a function like this

function send(url, data){

            $.ajax({
                url: url,
                data: data,
                cache: false,
                success: function(msg){
                 alert('success :'+msg);   
                },
                error: function(msg){
                    alert('error: '+msg);
                },
                complete: function(msg){
                    alert('complete: '+msg);
                }

            });

            alert('sending to :'+url +'   using: '+data);
        }

it works well when using the emulator, the server can read the data.

but when I upload it to the cloud and apply it on the iphone / ipad, the server cannot get the data.

any idea is appreciated

Thanks

James Pang
  • 11
  • 1

1 Answers1

0

This is likely a problem with not using XHR.js, or if you are its not properly placed in your code base.

What XHR.js does is overcome a handful of problems with cross domain issues, and other policys in place that would prevent a browser-esk environment from communicating with a server. With out more context to how your attempting to load your code, or what your URL is, or other things at the moment, like what kind of data "msg" is, such as xml, json, string, html, other.. its hard to come up with a definitive answer for you.

As the $.ajax() itself, currently looks fine.

Also on another note.. the emulator is only so helpful, yes, it emulates the concept of how things would look and kind of act in your device.. but at the end of the day its just a browser. It runs out of chrome. So many of things that work in a browser may not work in a mobile device the same way, they can work but sometimes you need to compensate for the difference.

chris
  • 36,115
  • 52
  • 143
  • 252