Widget:PillIdentifier: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 162: | Line 162: | ||
var printoutRequests = "|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name"; | var printoutRequests = "|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name"; | ||
var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query="+queryParameters+printoutRequests+"&format=json"; | var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query="+queryParameters+printoutRequests+"&format=json"; | ||
$.getJSON(jsonURL, function (data) { | $.getJSON(jsonURL, function (data) { | ||
if(data | if(countProperties(data.query.results) > 0){ | ||
$.each(data.query.results, function(ind, val) { | $.each(data.query.results, function(ind, val) { | ||
///////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////// | ||
Line 360: | Line 361: | ||
} | } | ||
}; | }; | ||
function countProperties (obj) { | |||
var count = 0; | |||
for (var property in obj) { | |||
if (Object.prototype.hasOwnProperty.call(obj, property)) { | |||
count++; | |||
} | |||
} | |||
return count; | |||
} | |||
</script> | </script> | ||
<style type="text/css"> | <style type="text/css"> |