在后台的Ajax刷新浏览器 [英] Ajax browser refresh in background

查看:77
本文介绍了在后台的Ajax刷新浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图点击后产生的背景刷新浏览器。

我的问题是我使用AJAX来处理页面上的其他元素ALLREAD但我需要这些更新。

  //批准 - 媒体链接批准节$('。allready_approved')。点击(函数(事件){
        。事件preventDefault();
    $('#main_bloc_approved')效果基本show();    //我需要在这里,但没有在这里重新加载页面进行刷新浏览器?     $('#main_bloc_allready_approved')淡入()。
     返回false;
     返回false;
});$('批准')。点击(函数(事件){
            。事件preventDefault();
    $('#main_bloc_allready_approved')效果基本show();     //我需要在这里,但没有在这里重新加载页面进行刷新浏览器?     $('#main_bloc_approved')淡入()。
     返回false;
});


解决方案

我认为你应该使用,除非我误解你:)

  $(文件)。就绪(函数(){
   $('身体')负载(window.location.href,体)。
});

也将您的。点击(...) .live('点击',...)

也有返回false; 这是只需要一次真正两次

这并不是说我想成为技术这个,但是,

(点击+号不必要的字节数)* =用户数更好地想起另一种方式例如 .setTimeout()更新每分钟节省一些带宽或照顾你觉得之前,你会破产:)但多数民众赞成我的意见,而不是一个事实:)

i am trying to produce a browser refresh in the background after a click.

My issue is i am allread using ajax to process other element on the page but i need these to be updated.

// approved - allready approved section

$('.allready_approved').click(function(event) {
        event.preventDefault();                 
    $('#main_bloc_approved').slideUp();

    // i need to perform a browser refresh here but without reloading the page here???

     $('#main_bloc_allready_approved').fadeIn();                    
     return false;


     return false;
});

$('.approved').click(function(event) {
            event.preventDefault();             
    $('#main_bloc_allready_approved').slideUp();

     // i need to perform a browser refresh here but without reloading the page here???

     $('#main_bloc_approved').fadeIn();
     return false;
});

解决方案

I think you should use, unless I have misunderstood you :)

$(document).ready(function (){
   $('body').load(window.location.href,'body');
});

also convert your .click (...) into .live('click',...)

also you have return false; twice which is only needed once really.

Not that I wanna be technical about this but,

(number of clicks + number of unnecessary bytes) * number of users = better think of another way e.g. .setTimeout() to update every minute to save some bandwidth or you will go bankrupt before you care to think :) but thats my opinion and not a fact :)

这篇关于在后台的Ajax刷新浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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