コメント |
@DIV
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
function getWebPageData(scode) {
// ***************************************
// Android WebView の中のこのページ
// より、サーバへアクセスします
// ***************************************
$.get("dbdata2_json.php?scode="+scode,function( data ){
if ( typeof androidObject !== 'undefined' ) {
// サーバから受け取った application/json データ
// を文字列に変換して Android に渡します
androidObject.toAndroid(JSON.stringify(data));
}
else {
// 通常のブラウザではこちらが実行されます
console.log(JSON.stringify(data,null," "));
}
})
}
</script>
</head>
<body>
<pre>
<?php
// Android の呼び出しテスト
?>
<input type="button" value="logcat test" onclick="androidObject.logcat('OK')">
<?php
// サーバからのデータで Android の呼び出しテスト
?>
<input type="button" value="toAndroid test" onclick="getWebPageData('0001')">
<a href="dbdata2_json.php?scode=0001">リンク</a>
</pre>
</body>
</html>
@END |