with out set time out I am not geting value in Product count, it comes undefined, Thanks in advance.
var fdvDdv = function () {
var RequestBody = {};
RequestBody.name = "productAssetCount";
RequestBody.parameters = [null, null];
var url = utility.webserviceUrl.getInShortDetails;
utility.postAjaxHelper(url, "POST", [RequestBody]).done(function (fdvDdvdata) {
$.each(fdvDdvdata[0].result, function (index, item) {
setTimeout(function () {
if (item.assetTypeId == '0704e697-b0bb-42e1-9555-46dc9a8eeb97') {
$('#fdv').html(item.assetCount);
fdvpercentage = floorFigure(parseFloat((item.assetCount / TotalProduct) * 100), 1);
} else if (item.assetTypeId == 'c5ded83b4c9b-b912-4d46-b1bb-84ff843e') {
$('#imgprodukter').html(item.assetCount);
bilderpercentage = floorFigure(parseFloat((item.assetCount / TotalProduct) * 100), 1);
}
}, 1000);
});
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log('fail');
});
};
Thanks for the response, I have created that particular method below is the code
var postAjaxHelper = function (uri, method, data) {
return $.ajax({
type: method,
url: uri,
dataType: 'json',
contentType: 'text/plain;charset=UTF-8',
data: data ? JSON.stringify(data) : null,
});
};