Template:Team:TU Delft/PartView

From 2010.igem.org

(Difference between revisions)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
-
<div id="jsonp</html>{{{part}}}<html>"></div>
+
<div id="jsonp</html>{{{part|BBa_B0032}}}<html>">
 +
</div>
<script type="text/javascript">
<script type="text/javascript">
-
var partName = "</html>{{{part}}}<html>";
+
$(function() {
-
var webserviceURL = "http://igempartview.appspot.com/query/json?jsonp=jsonpCallback";
+
var amp = String.fromCharCode(38);
-
webserviceURL += partName + "&param=name&value=" + partName;
+
var partName = "</html>{{{part|BBa_B0032}}}<html>";
 +
var callbackName  = "</html>{{{callback|_jsonpCallback}}}<html>";
 +
 
 +
if (callbackName == '_jsonpCallback')
 +
callbackName += partName;
 +
 
 +
// default callback
 +
window['_jsonpCallback' + partName] = function (parts) {
 +
var part = parts[0];
 +
// this will be called by JSON code
 +
alert(part.name + ': ' + part.desc);
 +
};
 +
 
 +
var webserviceURL = "http://igempartview.appspot.com/query/json?jsonp=" + callbackName;
 +
webserviceURL += amp + "param=name" + amp + "value=" + partName;
 +
 
 +
var html = '<scr'+'ipt src="' + webserviceURL + '"></scr'+'ipt>';
 +
$("#jsonp"+partName).append(html);
 +
});
 +
 
-
var html = '<scr'+'ipt src="' + webserviceURL + '"></scr'+'ipt>';
 
-
$("#jsonp"+partName).insert(html);
 
</script>
</script>
</html>
</html>

Latest revision as of 19:38, 26 October 2010