jQuery Mobile で JSON を使用して単純な html コンテンツを取得する方法を理解しようとしています。
これが私がこれまで行ってきた方法です:
matchinfo.php:
$str = '<h2>This is a test</h2><p>What is going on here?</p>';
echo $_GET['callback'] . '(' .json_encode($str). ')';
そして、これが私がそれを受信しようとする方法です:
$(document).on('pageshow', function (){
$.mobile.loading('show');
$.getJSON("http://mypage.com/matchinfo.php", function (result){
$("#pageName").html(result.html);
});
$('#pageName').content('refresh');
$.mobile.loading('hide');
});
スピナーはロードし続けます!リストビューでこれを行うことができますが、ここではコンテンツを取得したいだけです!?
どんな助けでも大歓迎です、そして前もって感謝します:-)