Widget:CJP2: Difference between revisions

Jump to navigation Jump to search
Christopher Popma (talk | contribs)
No edit summary
Christopher Popma (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<script type="text/javascript">
<script type="text/javascript">
function ensureLoggedIn() {
$(document).ready(function() {
mw.loader.load('mediawiki.Api', function() {;
mw.loader.load('mediawiki.Api', function() {
var api = new mw.Api();
var api = new mw.Api();
api.get({
api.get({
Line 8: Line 8:
query : '[[Pill Shape::Oval]]|?Pill Imprint|?Pill Dosage|?Pill Ingred|?Pill Color|?Pill Shape|?Pill Size (mm)|?Pill Scoring|?NDC|?Pill Name',
query : '[[Pill Shape::Oval]]|?Pill Imprint|?Pill Dosage|?Pill Ingred|?Pill Color|?Pill Shape|?Pill Size (mm)|?Pill Scoring|?NDC|?Pill Name',
format : 'json'
format : 'json'
}).always(function (data) {
},function(data) {alert("Data: " + data);});
                /*.always(function (data) {
$.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//
Line 22: Line 23:
var ndc = value.printouts["NDC"];
var ndc = value.printouts["NDC"];
var pillName = value.printouts["Pill Name"];
var pillName = value.printouts["Pill Name"];
/*
//Find a <table> element with id="resultsTable-body":
//Find a <table> element with id="resultsTable-body":
var table = document.getElementById("resultsTable-body");
var table = document.getElementById("resultsTable-body");
Line 52: Line 53:
cellNDC.innerHTML = ndc;
cellNDC.innerHTML = ndc;
cellPillName.innerHTML = pillName;
cellPillName.innerHTML = pillName;
*/




Line 59: Line 60:
var newRow = '<tr> <td>' + drugNameShort + '</td> <td>' + pillImprint + '</td> <td>' + pillDosage + '</td> <td>' + pillIngred + '</td> <td>' + pillColor + '</td> <td>' + pillShape + '</td> <td>' + pillSize + '</td> <td>' + ndc + '</td> <td>' + pillName + '</td> </tr>';
var newRow = '<tr> <td>' + drugNameShort + '</td> <td>' + pillImprint + '</td> <td>' + pillDosage + '</td> <td>' + pillIngred + '</td> <td>' + pillColor + '</td> <td>' + pillShape + '</td> <td>' + pillSize + '</td> <td>' + ndc + '</td> <td>' + pillName + '</td> </tr>';
//Append the new row with the information.//
//Append the new row with the information.//
$('#resultsTable-body').append(newRow);
$('#resultsTable-body').innerHTML(newRow);
});
});  
});  
});*/
});   
});   
};
});  
$(document).ready(ensureLoggedIn());  
</script>
</script>
<div id="resultsTable-container">
<div id="resultsTable-container">

Latest revision as of 13:06, 3 June 2014