[jQuery] basic understanding of jquery and XMLresponse

[jQuery] basic understanding of jquery and XMLresponse


Hello I trying to start with jQuery, I have a working Ajax solution in pure
javascript from before and I'd like to benefit from jquery in this way:
the server returns XML in form like
Content-Type: text/xml
<?xml version="1.0" encoding="utf-8"?>
<result>
<parts
jquery="jQuery(&quot;#parts&quot;).find(&quot;ul&quot;).prepend(&quot;&lt;li&gt;74117417
09.04.08 16:22:31&lt;/li&gt;&quot;)"/>
<status>status</status>
</result>
in readable form
jQuery("#parts").find("ul").prepend("<li>data time variables</li>")
In xhtml code there is code
<div id="parts">
<ul><li>data time variables</li>
</ul>
</div>
And there is and "universal script" which go thought responseXML and looks
for "parts" id on page and eval the content of jquery attribute.
function aj_set(xmlhttp) {
if(xmlhttp.readyState == 4) {
var x=xmlhttp.responseXML.documentElement;
....loop throught all xml entities...
if (jQuery("parts",x.responseXML).attr("jquery")!=null){
eval(jQuery("parts",x.responseXML).attr("jquery"));
}
And here my confusion starts - it works for first call, but all other call
returns still the same values.
when I add an alert with length after eval
if (jQuery(i,x.responseXML).attr("jquery")!=null){
eval(jQuery("parts",x.responseXML).attr("jquery"));
alert(jQuery("parts",x.responseXML).length);
}
I get increading number as a result of alert for every next call. Can someone
explain me if it's a feature, or do I use it in a bad way? I tested that
result object contains all the history of Ajax calls and at the end is the
current result.
Meantime I found that I can use
jQuery("parts:last",x.responseXML) to overcme it, but I still do not
understand why there is not only the last result....