I have spent the last 30 mins figuring this out.
Let's assume the following case:
<script>
var x = 0 ; //global variable
function compute() {
x = x+1;
}
</script>
Should the value of x be incremented so I can access it into a function later on?
I have the following codes:
var id1 = 0;
var id2 = 0;
$.ajax({
url: "http://localhost/twee/chat/comment",
type: 'POST',
data: form_data,
success: function(data) {
var data1 = parseInt(data);
id1 = id2 = data1;
}
});
I want to be able to access the values of id1 and id2 (updated since i declared them as 0) in a later function.
However, the value is staying zero and data1 is retrieved just fine.
parseIntwithout specifying the base with the second argument. developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…