I am receiving an "Undefined" statement for some parts of my xml anyone know why? It is showing the picture, and the headline but the text is just showing up as undefined
Here is the xml:
<Parent>
<Child
land="Germany"
headline="Beer"
src="images/beer.png"
text="Das klassische Schwarzbier hat seinen Ursprung in Thüringen"
ingredients="Water, Hops"
/>
</Parent>
And to the JQuery
$(function () {
$(window).bind('load', function () {
$.ajax({
type: "GET",
url: "test.xml",
async: false,
dataType: "xml",
success: Template
});
});
function Template(xml) {
$(xml).find('Parent').each(function () {
/* BODY IS CREATED HERE */
$(xml).find('Child').each(function () {
$('<div id="inline-' + ($(this).attr('headline')) + '" class=sensebox-container"><div class="sensebox-img"><img src="' +($(this).attr('src')) +'">' +
'<h3>' + ($(this ).attr('headline')) + '</h3><p>' + ($(this ).attr('text')) + '</p>').appendTo(body);
})
})
No comments:
Post a Comment