栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Ajax Preloader在Firefox中无法在Chrome浏览器中运行

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Ajax Preloader在Firefox中无法在Chrome浏览器中运行

我看过你的密码

众所周知,同步请求将锁定UI。因此,在chrome和safari上就不足为奇了(有趣的是在Firefox中)

你可以尝试这样的事情吗

jQuery('#customtag_widget-2 .compare_attribute').bind('change',jQuery.filterProductsCompare2 = function () {$.ajaxSetup({async:false});jQuery('#ajax_loader_div').css('display', 'block');jQuery('#ajax_loader_div').html('<img src="http://vcompare4u.com/wpcompare/wp-content/themes/compare/_assets/img/ajax-loader.gif" / >');jQuery('#customtag_widget-2 .compare_attribute_group').each(function () {        jQuery(this).children().each(function () { if (jQuery(this).children('.compare_attribute').attr('checked')) {     if (jQuery(this).children('.compare_attribute').attr('name').indexOf('b[') != -1) {         brands.push(jQuery(this).children('.compare_attribute').attr('value'));     }     if (jQuery(this).children('.compare_attribute').attr('name').indexOf('c[') != -1) {         categories.push(jQuery(this).children('.compare_attribute').attr('value'));     } }        })    } else {        minmaxarr = jQuery(this).attr('value').split(';');        minPrice = minmaxarr[0];        maxPrice = minmaxarr[1];    }    if (!jQuery.support.placeholder) {        if (isEmptyPlaceholder == 1) { jQuery(this).val('Search...');        }    }})if (jQuery('#dont_change_price').is(':checked')) {    minPrice = jQuery('#overall_min').val();    maxPrice = jQuery('#overall_max').val();} else {}jQuery.ajax({    url : file_url,    data: {        ajaxsearch : '1',        s : 'compare',        ki : keywords_comparei,        product : '',        c : categories,        b : brands,        checked_id : checked_string,        dont_change_price : dont_change_price,        min : minPrice,        max : maxPrice,        product_category : product_category    },    success : function (data) {        // Do stuff here    }});jQuery.ajax({    url : bracket_file_url,    data: {        ajaxsearch : '1',        s : 'compare',        ki : keywords_comparei,        product : '',        c : categories,        b : brands,        checked_id : checked_string,        min : minPrice,        max : maxPrice,        product_category : product_category    },    success : function (bracket_data) {        // DO stuff here    }});if (!jQuery('#dont_change_price').is(':checked')) {jQuery.ajax({    url : price_file_url,    data: {        ajaxsearch : '1',        s : 'compare',        ki : keywords_comparei,        product : '',        c : categories,        b : brands,        checked_id : checked_string,        min : minPrice,        max : maxPrice,        product_category : product_category    },    success : function (price_data) {        // DO stuff here    }});}jQuery('#ajax_loader_div').hide();jQuery('#ajax_loader_div').html('');$.ajaxSetup({async:true});});

我想做的是为每个ajax请求执行同步请求,而不是使用成功函数,我分别使用ajax请求。由于同步的性质,每个请求将一个接一个地处理。

在chrome控制台中检查您的代码,我已经看到Ajax加载器非常少的时间立即被隐藏起来。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/406806.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号