BIG EDIT 11/19/2012
So, my problem is here. I'm trying to develop a simple cart app with jQuery and XML.
Everything's OK, but only if the name of My pizz only contains numbers... WHY ???
Try yourself, you'll constat that only the "66666" pizza is working... WHY ???
Here is my jS code:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "example.xml",
dataType: ($.browser.msie) ? "text" : "xml",
success: function(xml) {
$(xml).find('row').each(function(){
var Col0 = $(this).find('nompizz').text();
var Col1 = $(this).find('petit').text();
var Col2 = $(this).find('moyen').text();
var Col3 = $(this).find('grand').text();
$('<tr id="bar"></tr>').html('<th class="title">'+Col0+'</th><td onclick="DisPlay('+Col1+');GetName('+Col0+');">'+Col1+'€</td><td onclick="DisPlay('+Col2+');GetName('+Col0+');">'+Col2+'€</td><td onclick="DisPlay('+Col3+');GetName('+Col0+');">'+Col3+'€</td>').appendTo('#pizzas');
});
}
});
});
function DisPlay(Figure) {
var Display = document.getElementById('Display');
if (Figure === null) {
Display.value = Figure;
}
else {
Display.value += "+"+Figure;
Screen = Display.value
result = eval(Screen);
Display.value =result;
}
Figure = null;
}
function GetName(NomPizz) {
var $newItem = '<li>Ajouté: '+NomPizz+'</li>';
$('.theList').append($newItem);
}
And here my XML:
<?xml version="1.0"?>
<document>
<row>
<nompizz>66666</nompizz>
<petit>10</petit >
<moyen>15</moyen >
<grand>20</grand>
</row>
<row>
<nompizz>Letters</nompizz >
<petit>15</petit >
<moyen>20</moyen >
<grand>25</grand>
</row>
</document>