Hell

by fakeguybrushthreepwood

HTML

<!DOCTYPE html>
<html>
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>    
</head>
<body>
    <div data-role="page" id="index">
        <div data-role="content">
        	<div data-role="collapsible-set" data-theme="b" data-content-theme="d" id="movie-data">
            </div>
        </div>
    </div>
</body>
</html>

CSS

li span {
font-weight: normal;
}

JavaScript

$('#index').live('pagebeforeshow',function(e,data){ 
    $.ajax({url: "http://api.themoviedb.org/2.1/Movie.search/en/json/23afca60ebf72f8d88cdcae2c4f31866/The Goonies",
        dataType: "jsonp",
        jsonpCallback: 'successCallback',
        async: true,
        beforeSend: function() {
            $.mobile.showPageLoadingMsg(true);
        },
        complete: function() {
            $.mobile.hidePageLoadingMsg();
        },
        success: function (result) {
            ajax.parseJSONP(result);
        },
        error: function (request,error) {
            alert('Network error has occurred please try again!');
        }
    });         
});


var ajax = {  
    parseJSONP:function(result){
        //var jsonObj = jQuery.parseJSON(parameters);
        
        $('#movie-data').append('<div data-role="collapsible" id="collapsible1"></div>');
        $('#movie-data').listview('refresh');    
        $('#collapsible1').append('<ul data-role="listview" data-inset="true" id="movie-listview" data-theme="a">');
        $('#collapsible1').listview('refresh');    
        $('#movie-listview').append('<li>Rating:<span> ' + result[0].rating+ '</span></li>');
         $('#movie-listview').listview('refresh');    
            
    }
}