1//**
2//Remove the var keyword on global_datalength to make it global.
3//**
4//You can also use window.global_datalength.
5//**
6//Another way is to declare the variable outside the jQuery ready function.
7//**
8
9function leavereminder() {
10 $.ajax({
11 dataType: "json",
12 url: "<?=base_url()?>home/leavereminder",
13 async: false,
14 success: function(data) {
15 if(data.length != 0) {
16 for(x=0; x<data.length; x++) {
17 var lblm = document.createElement('div');
18 lblm.innerHTML = '<label>'+data[x]+'</label>';
19 lblm.className = 'alert alert-info';
20 document.getElementById('notifbody').appendChild(lblm);
21 }
22 }
23 global_datalength = datalength;
24 },
25 });
26}
27