Forum Moderators: open
<script>
var startCount = 2;
function showData(x) {
alert(x);
}
function loadMore(listID) {
$(listID).append($('<div></div>')
.load($('example'), function() {
startCount += 2;
showData(startCount);
})
);
}
var startCount = 2;
function showData() {
startCount += 2;
alert(startCount);
}
var startCount = 2;
What happens if you omit the "var" and proceed directly to startCount = 2;
? I'm wondering if the script somehow thinks startCount is being redefined over and over again. (I realize the script should not think this, because global is global, but who knows what goes on in the mind of a browser.) And then, if it does behave differently, you're closer to figuring out what is going on.