Tried to write a function which reads data from a text file. The function is working fine but I want to read its data in other function. Could some one help me telling how to return the value of y to read() function
<!DOCTYPE html>
<html>
<head>
<script charset="utf-8" src="jquery-2.0.3.min.js"></script>
<script type="text/javascript">
function read() {
$.get("version.txt?_ts=" + new Date().getTime(), function (data) {
var y1 = parseInt(data[0]);
var y2 = parseInt(data[1]);
var y = (y1 * 10) + y2;
return y;
});
}
function drr() {
var d = read();
document.write(d);
}
</script>
<body onload=read()>not working</body>
</html>