jQuery global variable problem
Posted
by Emanuel
on Stack Overflow
See other posts from Stack Overflow
or by Emanuel
Published on 2010-03-02T19:35:13Z
Indexed on
2010/05/24
20:11 UTC
Read the original article
Hit count: 195
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
...
}
Why in the following example I can't reinitialize the id variable? What is wrong?
Thanks.
© Stack Overflow or respective owner