Blowtar
24 Apr 2011, 04:36 PM
Hi guys.
I have a huge problem and I've been working on it alllllll day! For some weird reason I can't manage to get it working, so here it is:
I've managed to bring in XML text and style it using jQuery, and all works perfect, now the only thing is, is that the image does't work with it, and it is very annoying. I've tried multiple thing such as creating Variables relating to the XML tag that contains the image etc... It just does not work.
Here is my code.
jQuery:
<script>
$(document).ready(function () {
$.ajax({
type: "GET",
url: "xml/staff.xml",
dataType: "xml",
success: xmlParser
});
});
function xmlParser(xml) {
$('#load').fadeOut();
$(xml).find("Staff").each(function () {
$(".main").append('<div class="staff"><div class="name">' + $(this).find("Name").text() + '</div><div class="role">' + $(this).find("Role").text() + '</div><div class="email">' + $(this).find("Email").text() + '</div><div class="phone">' + $(this).find("Phone").text() + '</div><div class="type">' + $(this).find("Type").text() + '</div><div class="image">' + $(this).find("Image").text() + '</div></div>');
$(".staff").fadeIn(1000);
});
}
</script>
No the last div tag is the image, and the XML image directory 100% works I tested it on another code. Now I've tried changing the .text to .load or .image but they do not work either.
Any help at all would be greatly appreciated, thanks a lot peeps.
I have a huge problem and I've been working on it alllllll day! For some weird reason I can't manage to get it working, so here it is:
I've managed to bring in XML text and style it using jQuery, and all works perfect, now the only thing is, is that the image does't work with it, and it is very annoying. I've tried multiple thing such as creating Variables relating to the XML tag that contains the image etc... It just does not work.
Here is my code.
jQuery:
<script>
$(document).ready(function () {
$.ajax({
type: "GET",
url: "xml/staff.xml",
dataType: "xml",
success: xmlParser
});
});
function xmlParser(xml) {
$('#load').fadeOut();
$(xml).find("Staff").each(function () {
$(".main").append('<div class="staff"><div class="name">' + $(this).find("Name").text() + '</div><div class="role">' + $(this).find("Role").text() + '</div><div class="email">' + $(this).find("Email").text() + '</div><div class="phone">' + $(this).find("Phone").text() + '</div><div class="type">' + $(this).find("Type").text() + '</div><div class="image">' + $(this).find("Image").text() + '</div></div>');
$(".staff").fadeIn(1000);
});
}
</script>
No the last div tag is the image, and the XML image directory 100% works I tested it on another code. Now I've tried changing the .text to .load or .image but they do not work either.
Any help at all would be greatly appreciated, thanks a lot peeps.