Skip to content

Instantly share code, notes, and snippets.

@neilfws
Created January 19, 2011 06:38
Show Gist options
  • Save neilfws/785785 to your computer and use it in GitHub Desktop.
Save neilfws/785785 to your computer and use it in GitHub Desktop.
Corrected version of sample code from http://www.ebi.ac.uk/gxa/help/AtlasApis, using Haml
:javascript
function processData(data) {
if(data.error) {
alert(data.error);
return;
}
alert('Accession: ' + data.results[0].experimentInfo.accession + '\nDescription: ' +
data.results[0].experimentInfo.description);
}
function queryExperiment(experimentId) {
var head = document.getElementsByTagName('head');
var script = document.createElement('script');
var atlasHomeUrl = "http://www.ebi.ac.uk/gxa";
script.type = "text/javascript";
script.src = atlasHomeUrl + "/api?experiment=" + escape(experimentId) +
"&format=json&callback=processData";
head[0].appendChild(script);
}
%input{:type => "button", :value => "Show experiment", :onclick => "queryExperiment('E-AFMX-1')"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment