json response is received and shown to users in and it works without issue but if i want to show javascript alert it is not working.
during initial pageload that var is empty so i dont expect that to process so i have disabled javascript processing if var is empty but when the form is uploaded and json data is returned then its not empty and correctly formatted json data which is visible under value { x: 3, y: 33.6 },{ x: 4, y: 92.6 },{ x: 5, y: 121.2 } but when i try to alert the same thing with javascript it does not worked i always get empty message never gets done message.
<script>
$(document).ready(function() {
var ndhtml =[];
if(ndhtml.length==0)
{
alert('empty string')
}
else
{
var kkpppf=$("#chek").html(ndhtml);
alert('done');
}
});
</script>
any advise how to update json data here will be great. first js file is external file and code of that file is
$(document).ready(function() {
(function() {
$('#upload-form2').ajaxForm({
dataType: 'json',
success: function(data) {
var ndhtml = '',
downlo;
for (var i = 0; i < data.length; i++) {
downlo = data[i];
ndhtml += '' + downlo.ndchart + '';
}
$('#chek').html(ndhtml);
}
})
})();
});