$。阿贾克斯()上的PhoneGap阿贾克斯、PhoneGap

由网友(相思赋予谁)分享简介:任何人都知道的的PhoneGap 的与 $一个例子。阿贾克斯()中的 github上的为Android?我已阅读JSONP或CORS,但我只工作从Twitter请求数据。Anyone know an example of phonegap with $.ajax() in github for Android? I...

任何人都知道的的PhoneGap 的与 $一个例子。阿贾克斯()中的 github上的为Android?我已阅读JSONP或CORS,但我只工作从Twitter请求数据。

Anyone know an example of phonegap with $.ajax() in github for Android? I have read of JSONP or CORS but I have worked only requesting data from Twitter.

我只是需要让我的数据服务器。

I just need to get my data server.

推荐答案

它是通过jQuery Mobile的非常容易。你可以用正常的Ajax和JSON的点点做你的工作。我做了与PHP服务器。在这里,样品code,

It is very easy through jquery mobile. You can do your job with normal Ajax and little bit of JSON. I done with php server. Here the sample code,

通过jQuery的发送请求到服务器。

Sending request to server through jquery.

$.ajax({
          url: <your Server URL>,
          dataType: 'jsonp',
          jsonp: 'jsoncallback',
          timeout: 5000,
          success: function(data, status){
                             /*Process your response here*/
                        }
       });

在PHP服务器上的文件,

In php server file,

<?php
$data="I am sending response to you";

/*you have to mention this callback compulsory*/

echo $_GET['jsoncallback'] . '(' . json_encode($data) . ');';
?>
阅读全文

相关推荐

最新文章