Widget:CJP3: Difference between revisions

Jump to navigation Jump to search
Christopher Popma (talk | contribs)
No edit summary
Christopher Popma (talk | contribs)
No edit summary
Line 2: Line 2:
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
     <script type"text/javascript">
     <script type"text/javascript">
$(document).ready(ensureLoggedIn);
$(document).ready(ensureLoggedIn);


function ensureLoggedIn() {
function ensureLoggedIn() {
Line 18: Line 18:
$('#button').click(function() {
$('#button').click(function() {
var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query=[[Pill%20Shape::Oval]]|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name&format=json"
var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query=[[Pill%20Shape::Oval]]|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name&format=json"
$.getJSON(jsonURL)
$.getJSON(jsonURL, function (data) {
.always(function (data) {
alert('Success!');
$.each(data.query.results, function (index, value) {
$.each(data.query.results, function (index, value) {
//Assign variables the values returned from the function//
//Assign variables the values returned from the function//

Revision as of 18:51, 3 June 2014