请告诉我如何在下面的代码中替换setTime [英] any one please let me know how I can replace setTime out in the below code

查看:58
本文介绍了请告诉我如何在下面的代码中替换setTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有设定的超时时间我没有在产品数量中计算价值,它未定义,提前谢谢。



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 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,
        });
    };

推荐答案

.each(fdvDdvdata [ 0 ] .result, function (index,item){
setTimeout( function (){
if (item.assetTypeId == ' 0704e697 -b0bb-42e1-9555-46dc9a8eeb97'){ // FDV的ID
.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 );
// 计算FDV的百分比
// var result = parseFloat(parseInt(item.assetCount,10)* 100)/ parseInt(
('#fdv').html(item.assetCount); // Calculate percent for FDV //var result = parseFloat(parseInt(item.assetCount, 10) * 100) / parseInt(


(#价钱2)。val(),10);
fdvpercentage = floorFigure( parseFloat ((item.assetCount / TotalProduct)* 100 ), 1 );
// alert(fdvpercentage);

} else if (item.assetTypeId == ' < span class =code-string> c5ded83b4c9b-b912-4d46-b1bb-84ff843e'){ // 图像ID
("#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


这篇关于请告诉我如何在下面的代码中替换setTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆