Ajax progress bar with a large list

综合技术 2017-12-30

I have an ajax call that is grabbing a large json list. Is there any way I can make a progress bar that gets the real value of json load (for example a status bar that says 1 out of 200 loaded)?

Right now I have a pretty basic Ajax call

function SendAjax(urlMethod, jsonData, returnFunction) {
        type: "GET",
        contentType: "application/json; charset=utf-8",
        url: urlMethod,
        data: jsonData,
        dataType: "json",
        success: function (msg) {
            if (msg != null) {
        error: function (xhr, status, error) {
            // Boil the ASP.NET AJAX error down to JSON.

            var err = eval("(" + xhr.responseText + ")");

            // Display the specific error raised by the server

Try using AjaxStart
on your application global scope. That means you can put the code in your layout file, and if the processing is long, it will show the progress indicator...

$(document).ajaxStart(function() {
   $( "#loading" ).show();

You can see the example and answer at preload with percentage - javascript/jquery.

Hello, buddy!

责编内容by:Hello, buddy! (源链)。感谢您的支持!


SweetAlert – Change Modal Width? I love this library. I'd like to use it to display a moderate response table on one of my web pag...
Can I return data from an anonymous callback funct... I'm sure this is simple, but I'm tripping up over a scope issue in Javascript. I'm doing the followi...
fancyBox3 中文文档 也可以在 GitHub wiki 上查看。 说明:本文档仅供参考,更新不及时请查看官方文档。 1. 介绍 fancyBox 是一个 JavaScrip...
Ajax Response 200 ok, but shows that the... I am making an ajax call to a backend rest api, the api is returning fine. If I console.log() the su...
JS实现的ajax和同源策略 一、回顾jQuery实现的ajax 首先说一下ajax的优缺点 优点:AJAX使用Javascript技术向服务器发送异步请求; AJAX无须刷新整个页面; 因为服务器响应内容不再是整个...