Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><head>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
- <script type="text/javascript">
- $( function() {
- $('#loadBtn').bind ( 'click', function(){ load(); } );
- } );
- var linkUrl = "http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en";
- var load = function() {
- $.ajax(
- {
- dataType : "jsonp",
- jsonp : "jsonp",
- url : linkUrl,
- error : function(data) {
- alert("Error - 2");
- },
- success : function(response){
- document.getElementById("quote").innerHTML = response.quoteText;
- document.getElementById("author").innerHTML = response.quoteAuthor;
- }
- });
- };
- </script>
- </head>
- <body>
- <div data-role="page" id="main">
- <div data-role="header">
- <h1>Forismatic Sample App</h1>
- </div>
- <div data-role="content">
- <a id="loadBtn" data-role="button">Load</a><br>
- <div id="quote" style="font-weight: bold;"></div><br>
- <div id="author"></div>
- </div>
- <div data-role="footer" data-position="fixed">
- </div>
- </div>
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement