Template:Team:Paris-Saclay/left-column

From 2012.igem.org

(Difference between revisions)
Line 17: Line 17:
</div>
</div>
<script type="text/javascript">
<script type="text/javascript">
 +
$(document).ready(function() {
 +
    var Category;
 +
    var url = document.location.href;
 +
    var idxPS = url.indexOf("Team:Paris-Saclay",0);
 +
    Category = url.substring(idxPS,url.length-1);
 +
   
 +
    $.ajax({
 +
    type: "GET",
 +
    url: "https://2012.igem.org/wiki/api.php", // name of file you want to parse
 +
    async : false,
 +
data:{
 +
format: 'xml',
 +
action: 'query',
 +
titles: "",
 +
prop: 'categories'},
 +
    dataType: "xml", // type of file you are trying to read
 +
    success  : function(xmlData){
 +
$(xmlData).find('cl').each(function() {
 +
                Category = $(this).attr("title");
 +
} )
 +
},
 +
error : function(){
 +
}
 +
});
 +
});
 +
 +
$(document).ready(function() {
$(document).ready(function() {
     $.ajax({
     $.ajax({
Line 26: Line 53:
action: 'query',
action: 'query',
list: 'categorymembers',
list: 'categorymembers',
-
cmtitle: 'Category:Team:Paris-Saclay/Test'},
+
cmtitle: Category},
     dataType: "xml", // type of file you are trying to read
     dataType: "xml", // type of file you are trying to read
     success  : function(xmlData){
     success  : function(xmlData){

Revision as of 18:26, 20 August 2012

Follow us !