XML filter is applied to non-XML value
Hello,
I'm using
jCarousel, to set up carousel, and display requested items with
AJAX.
Here are my to trouble-maker functions :
-
function mycarousel_itemLoadCallback(carousel, state)
{
// Check if the requested items already exist
if (carousel.has(carousel.first, carousel.last)) {
return;
}
$.get(
'dynamic_ajax_php.php',
{
first: carousel.first,
last: carousel.last
},
function(xml) {
mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
}, 'html'
);
};
function mycarousel_itemAddCallback(carousel, first, last, xml) {
// Set the size of the carousel
carousel.size(parseInt(jQuery('total', xml).text()));
jQuery('product', xml).each(function(i) {
var product_id = jQuery.('product_id', xml).text();
carousel.add(first + i, mycarousel_getItemHTML(jQuery(this).text()));
});
};
This code returns a "XML filter is applied to non-XML value" error in Firebug.
If I switch from
-
$.get(
'dynamic_ajax_php.php',
{
first: carousel.first,
last: carousel.last
},
function(xml) {
mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
}, 'html'
);
to
-
$.get(
'dynamic_ajax_php.php',
{
first: carousel.first,
last: carousel.last
},
function(xml) {
mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
}, 'xml'
);
then mycarousel_itemAddCallback is not even called.
Here is the string returned by dynamic_ajax_php.php :
<data> <total>9</total> <product> <product_id>2</product_id> <product_title>T-shirt Beige mootools</product_title> </product> <product> <product_id>3</product_id> <product_title>T-shirt Blanc mootools</product_title> </product> <product> <product_id>4</product_id> <product_title>T-shirt Vert mootools</product_title> </product> <product> <product_id>5</product_id> <product_title>T-shirt Bleu mootools</product_title> </product></data>
Any idea what's going wrong ?