I'm trying to figure out how to retrieve simple html content using JSON in a jQuery Mobile.
Here is how I have done so far:
matchinfo.php:
$str = '<h2>This is a test</h2><p>What is going on here?</p>';
echo $_GET['callback'] . '(' .json_encode($str). ')';
And here is how I try to recieve it:
$(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');
});
The spinner just keeps loading! I am able to do this with listview, but here I just want to get some content!?
Any help is appreciated and thanks in advance :-)
htmlbut your data is just a flat string.json_encode(array('html' => $str));?callback=someCallbackin the url ?