Skip to content

Instantly share code, notes, and snippets.

@gordolio
Last active August 29, 2015 14:05
Show Gist options
  • Save gordolio/56f1c908e2ce8ce4a469 to your computer and use it in GitHub Desktop.
Save gordolio/56f1c908e2ce8ce4a469 to your computer and use it in GitHub Desktop.
Json data for MS treatment options
<!DOCTYPE html>
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div id="main-container" class="container">
<div class="page-header">
<h1>MS Treatment Options</h1>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function() {
var parse = function(data){
$.each(data.drugs,function(idx,drug){
drug.wikiText = drug.name.replace(/\s/gi,'_');
var d = $("<div></div>").attr('class','drug');
d.append($("<span></span>")
.attr('class','h3')
.text(drug.cn)
);
d.append(
$("<span></span>")
.append($("<a></a>")
.attr({
href:"http://en.wikipedia.org/wiki/"+drug.wikiText,
target:"_blank"
})
.text("("+drug.name+")"))
);
d.append(
$("<span></span>")
.attr("class","details btn btn-primary btn-xs")
.html("Details")
.click(function(){
$(this).next().toggle({duration:500});
})
);
d.append($("<div></div>")
.html(drug.details)
.css("display","none")
);
$("div#main-container").append(d).append($("<hr/>"));
});
};
$.ajax("https://rawgit.com/gordolio/56f1c908e2ce8ce4a469/raw/ms.json",{
complete:function(obj){
parse(obj.responseJSON);
}
});
});
</script>
</body>
</html>
{
"drugs":[{
"cn":"Copaxone",
"name":"Gatiramer acetate",
"details":"3 times a week shot. Lump at injection site in 30% of users. Flu like symptoms in 10% of users. Possible lipoatrophy"
},{
"cn":"Avonex",
"name":"Interferon beta 1a",
"details":"once a week injection, may have skin reactions. Necrosis in 5% of users. Possible lipoatrophy"
},{
"cn":"Rebif",
"name":"Interferon beta 1a",
"details":"3 times a week injection (may have skin reactions)"
},{
"cn":"Aubagio",
"name":"Teriflunomide",
"details":"bad around pregnant women (can cause them to miscarry)"
},{
"cn":"Tecfidera",
"name":"Dimethyl fumarate",
"details":"pill, can have stomach problems. Decreases white blood cell count."
},{
"cn":"Gilenya",
"name":"Fingolimod",
"details":"first pill. Most common side effect is head colds, headache, fatigue. Should monitor electrocardiogram before treatment, then continuously for first six hours."
},{
"cn":"Mitoxantrone",
"name":"Mitoxantrone",
"details":""
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment