0

我需要一些关于 ajax 请求和在 jQuery 进度条中使用数据的帮助。

这是 index.html

<div id="progressbar"></div>

这是test.json

{ "progressbar":12 }

这是JavaScript代码

$(function() {

    $.ajax({ dataType:"json",
        url: test.json, 
        success: <!-- dont know what to do here -->,
    });

    $( "#progressbar" ).progressbar({
        value: <!-- Dont know what to do here  -->  
    });
});

对不起,我不习惯 jQuery 和 json。我会很高兴有一个很好的例子!!!

非常感谢你!

4

1 回答 1

2

用你的成功更新进度条

$(function() {
    $.ajax({ dataType:"json",
        url: "https://gist.githubusercontent.com/quannt/d60905a978058de2312b/raw/2d4ab1df422dc19b7214d10ffd5e80795e2aa0a5/gistfile1.txt", 
            success: function(data){
                $( "#progressbar" ).progressbar({
                    value: data.progressbar
                });
            }
    });
});

在这里提琴

于 2015-02-07T15:00:08.477 回答