带有AJAX请求的JSON的jQuery进度栏 [英] jQuery progressbar with ajax request to json

查看:121
本文介绍了带有AJAX请求的JSON的jQuery进度栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些有关ajax请求以及jQuery进度栏中的数据使用的帮助.

I need some help with an ajax request and the use of data in a jQuery progressbar.

这是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.我很高兴有一个很好的例子!!!

I am sorry, but I am not used to jQuery and json. I would be glad for a really good example!!!

非常感谢!

推荐答案

使用您的成功来更新进度条

Use your success to update the progress bar

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

在这里拨弄

这篇关于带有AJAX请求的JSON的jQuery进度栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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