i have javascript with name something.js. in js file i have funtion like this
$(document).ready(function() {
tampilInterval();
$('#mydata').html();
function tampilInterval() {
$.ajax({
type : 'ajax',
url:$("#baseurl").val(),
dataType:"json",
method:"post",
success : function(data){
var html = '';
var i;
html += '<tr>'+
'<td>'+data[0].key+'</td>'+
'<td><input type="text" class="form-control" id="int0" name="int0" value="'+data[0].value+'"></td>'+
'</tr><tr>'+
'<td>'+data[1].key+'</td>'+
'<td><input type="text" class="form-control" id="int1" name="int1" value="'+data[1].value+'"></td>'+
'</tr>';
$('#show_data').html(html);
}
});
};
in my case, i want to use value from id -> int0 and int1 to another function in same file.
i have code to get and check that values like this
var int0 = document.getElementsByName('int0').value;
var int1 = document.getElementById('int1');
but it said 'null'.
how to get that value ? or how to make variables int0
and int1
into global variables that already have value? thank you
`, but is still the same result.
– Tobok Sitanggang Feb 28 '18 at 16:59