Skip to content

Instantly share code, notes, and snippets.

@judsonmitchell
Created March 5, 2015 23:49
Show Gist options
  • Save judsonmitchell/dc142138ae829110eb24 to your computer and use it in GitHub Desktop.
Save judsonmitchell/dc142138ae829110eb24 to your computer and use it in GitHub Desktop.
Getting API data using JQuery // source http://jsbin.com/qufogu
<!DOCTYPE html>
<html>
<head>
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>Getting API data using JQuery</title>
</head>
<body>
<h1></h1>
<h2></h2>
<div class="the-law">
</div>
<script id="jsbin-javascript">
$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
$('h1').html(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
$('div.the-law').html(data.html);
}
});
//http://loyolalawtech.org/miranda-case.json
/*
$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
console.log(data.citation.case_name);
$('h1').htVml(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
}
});
*/
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery.min.js"><\/script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"><\/script>
<meta charset="utf-8">
<title>Getting API data using JQuery</title>
</head>
<body>
<h1></h1>
<h2></h2>
<div class="the-law">
</div>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
$('h1').html(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
$('div.the-law').html(data.html);
}
});
//http://loyolalawtech.org/miranda-case.json
/*
$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
console.log(data.citation.case_name);
$('h1').htVml(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
}
});
*/
</script></body>
</html>
$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
$('h1').html(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
$('div.the-law').html(data.html);
}
});
//http://loyolalawtech.org/miranda-case.json
/*
$.ajax ({
type: 'GET',
url: 'http://loyolalawtech.org/json/miranda-case.json',
dataType: 'json',
success: function (data){
console.log(data.citation.case_name);
$('h1').htVml(data.citation.case_name);
$('h2').html(data.citation.federal_cite_one);
}
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment