//placed plugin globally, so it can be used globally
$.fn.digits = function(){
return this.each(function(){
$(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") );
})
}
//to add comma on JSON object
var areaname = $('h1.page-header').text(),
lookforstate = $('ol.breadcrumb li:last-child').text(),
trimstate = lookforstate.split(","),
resultstate = trimstate [trimstate.length-1],
getstate = $.trim(resultstate),
outlookLislnk = 'https://alice.propedge.my/property/v1/nsearch?&state=',
incDistrcRent = '&listing_type=rental&district=',
fulloutLisRent = outlookLislnk + getstate + incDistrcRent + areaname;
$('input#count-rent').fadeIn(300).val(fulloutLisRent.found).digits();
$('.count-rent').fadeIn(300);
});