I have a function in JS with a JQuery method, inside a script in HTML which gets data from a .txt.
In this .txt I have one line of text like this:
Test_1_NoOk
In the function, I make a split() and get the character "1" in a variable, as shown below.
$.get("Text.txt", function(data) {
var parts= data.split('_');
fail= parseInt(parts[1]);
});
After processing this information, I want the global variable "fail" to get that "1" and be painted in HTML division.
But when I paint it, it always stays like "0", because the value at the initialization of the varibale is that (it doesn't change).
Any way to overwrite the value of the global one, inside the function?