本文介绍了请告诉我如何在下面的代码中替换setTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 没有设定的超时时间我没有在产品数量中计算价值,它未定义,提前谢谢。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) { //alert(JSON.stringify(fdvDdvdata[0].result)); //alert(TotalProduct); $.each(fdvDdvdata[0].result, function (index, item) { setTimeout(function () { if (item.assetTypeId == '0704e697-b0bb-42e1-9555-46dc9a8eeb97') { //the Id of FDV $('#fdv').html(item.assetCount); // Calculate percent for FDV //var result = parseFloat(parseInt(item.assetCount, 10) * 100) / parseInt($("#price2").val(), 10); fdvpercentage = floorFigure(parseFloat((item.assetCount / TotalProduct) * 100), 1); //alert(fdvpercentage); } else if (item.assetTypeId == 'c5ded83b4c9b-b912-4d46-b1bb-84ff843e') {// the Id of Image $('#imgprodukter').html(item.assetCount); //calculate percent for Bidder(image) bilderpercentage = floorFigure(parseFloat((item.assetCount / TotalProduct) * 100), 1); //alert(bilderpercentage); } }, 1000); }); }).fail(function (jqXHR, textStatus, errorThrown) { console.log('fail'); });}; 感谢您的回复,我创建了下面的特定方法是代码Thanks for the response, I have created that particular method below is the codevar 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, }); };推荐答案 这篇关于请告诉我如何在下面的代码中替换setTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 00:47