UPDATE: the script works now (partially), but it fails to load some XML gadget files that have Javascripts in their Content; also, some are loaded fine but anything other then the Content it's still not displayed. I wonder if this can be done only in PHP rather than jquery.
I have the code that I use to load and display XML gadgets (like those from iGoogle). It is now my creation, in fact I don't even remember where I got it from.
Anyway, as you can see, the code reads the Content
from an XML file and displays it in the combo1
span. This works as it's supposed to.
The problem is that anything I write, before or after the span, doesn't show. Or it shows for a fraction, but immediately the Content is displayed and everything else is hidden. I would like the "I want this text visible !!!" to be, well, visible. How can I do that? I don't care if it is just text, or maybe jQuery can do another trick to display this, too (I've tried some, didn't work), or maybe "my" code is at fault and needs some changes.
All I know is that I need help.
P.S. if you need to test this use the Google's hello gadget: http://www.google.com/ig/modules/hello.xml - you must save it locally, I think the script doesn't read external files.
OK, for your reference, I have this:
<?PHP
$xml = $_GET['xml'];
echo "<html><head></head><body><script src='http://code.jquery.com/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function(){
function loadfail(){
alert('Error: Failed to read file!');
}
function parse(document){
$(document).find('Module').each(function(){
$('.combo1').append(
'' + $(this).find('Content').text() +
''
);
});
}
$.ajax({
url: '$xml',
dataType: 'xml',
success: parse,
error: loadfail
});
});
</script><span class='combo1'></span>";
?>Text that I'd like to show</body></html>