开发者

Send data to server

I am developing an app for the iphone.The thing is that i want to send the values of longitude and latitude i get from the phone using javascript to a server commanding it to search for something.Do i have to read about cross domain stuff? How could this be done? I know that i can use Ajax but it can serve me if i refer to the same domain.

For example how can i do this:

$.post('http://127.0.0.1:8000/search/',{lon:30}) and have my database searched for objects that have this longitude?

I don't want to do this:

$.post('/search/',{lon:30})

I use django on the ser开发者_运维百科ver side.


There is something called JSONP that is meant to solve this problem. You can read about it here. Its basically regular json with a callback function.


Also have a look at the below link:

http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/3f93834df24114b9/9c6596da9bedd4b2?q=#9c6596da9bedd4b2


JSONP or "serverside AJAX proxy" are your two options if the target server is in a different domain than your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜