如何在apk中通过javascript调用php,我使用的是webwiew和html5 javascript和jquery
我想从 php 中检索 json 数据
function ajaxFunction() {
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.addRequestInterceptor(new RequestAcceptEncoding());
httpclient.addResponseInterceptor(new ResponseContentEncoding());
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.smartcloudinfo.com/game/RainbowTreasure(IPAD)/RT_IPADV1.0.40/json.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("line_value",20));
nameValuePairs.add(new BasicNameValuePair("stake_value",0.2));
nameValuePairs.add(new BasicNameValuePair("balance_value",updated_Balance));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
alert("found"+HttpResponse response);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}