diff -r 000000000000 -r d970ebf37754 enmi12/glossaire/js/ajax.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/enmi12/glossaire/js/ajax.js Wed Nov 06 03:21:17 2013 +0000 @@ -0,0 +1,57 @@ +function xmlRequest(event){ + var req = null; + //document.ajax.dyn.value="Started..."; + + if (window.XMLHttpRequest) + { + req = new XMLHttpRequest(); + if (req.overrideMimeType) + { + req.overrideMimeType('text/xml'); + } + } + else if (window.ActiveXObject) + { + try { + req = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) + { + try { + req = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) {} + } + } + + + req.onreadystatechange = function() + { + //var loadingContent = + //$('.commentSection').append(' + if(req.readyState == 4) + { + if(req.status == 200) + { + // process a XML document here + + var xml = req.responseXML; + $xml = $(xml); + var mot = $(event.target).first().parents('div[data-mot]').attr('data-mot'); + var typologie = $(event.target).first().parents('div[data-mot]').attr('class'); + + typologie = typologie.replace(/(arsIndustrialis|discipline|thematique|vulgarisation) /gi, ''); + + console.log(typologie); + + var commentaires = $xml.find('mot[name]').filter(function() {return removeAccents($(this).attr("name").toLowerCase()) == mot;}); + var typologieComment = commentaires.children(); + + } + else + { + alert("Error: returned status code " + req.status + " " + req.statusText); + } + } + }; + req.open("GET", "comments.xml", true); + req.send(null); +} \ No newline at end of file