Problem mit globalen Variablen in jQuery
var id = $(this).children().html(); // id is 5
$.ajax({
url: 'ajax.php?id=' + id,
success: function(data) {
id = data; // id is 1
}
});
if(id == 1){ // id is again 5
...
}
Warum kann ich im folgenden Beispiel die ID-Variable nicht neu initialisieren? Was ist falsch?
Vielen Dank.