jQuery - global variable

0 votes
206 views
added Jun 19, 2018 in jQuery by LC Marshal Captain (25,790 points)
// var
var getProjname = $('.project-detail ul li:first-child .i-list-data').text(),
    outlookPLislnk = 'https://alice.edgeprop.my/property/v1/nsearch?&keyword=', 
    fullPLislink = outlookPLislnk + getProjname;

//declare global variable, outside function
var pslList;
$.getJSON(fullPLislink, function(projectCountSale) {
  var property_data = '';
  $.each(projectCountSale.property, function(index, row) {
  });
  pslList = projectCountSale.found;
  $('input#count-sale').val(pslList).digits(); 
  $('.count-sale').fadeIn(300);
});

//all properties summary
var propSale = parseInt(porList),
    propRent = parseInt(pslList),  
    allProp = (propSale) + (propRent); 
// alert(propSale+propRent);

$('input#count-project').val(allProp); 
$('.count-project').fadeIn(300);
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...