[jQuery] Pb with a reload of a table with Jquery
First, sorry for my bad english !!
I have a problem with a table which i don't managed to reload. I
generate this table after a parse of an XML file. i would like that if
my xml file changed my table was reloaded. And it is not working. I
managed to reload a line if it is alone, but not if it is a table with
many lines.
So i give my .js and my xml file :
First the .js file :
$.fn.recap = function(delay,ad_url,nom) {
var _news;
var _old;
var _counter = 0;
var difference =-1;
var init = function(el) {
setInterval( function() { method(el) }, delay);
method(el);
}
var method = function(el) {
$.ajax({
type: "GET",
url: ad_url,
dataType : "xml",
success: function(data){
var _news=$("data", data);
for (i=0; i < _news.length; i++)
{
_cur = _news[_counter];
difference=($
(_cur).attr("diff"));
if ( _counter !=
_news.length)
{
$(el).append("<tr num=
\"" + _counter + "\" ><td>" + $(_cur).attr("name") + "</td> <td>" + $
(_cur).text() + "\"</td></tr>");
_counter++;
}
}
}
})
};
_counter=0;
init(this);
}
and now my xml file which was parsed :
<results>
<description></description>
<checks>
<data name="host1" etat="CRITICAL" erreur="1" diff="1">
1 service critique !
</data>
<data name="host2" etat="CRITICAL" erreur="1" diff="1">
1 service critique !
</data>
</checks>
</results>
It is usefull to know tath if the xml change so the option diff in the
tag data will changed.