jquery刷新页面代码及js常用函数汇总
一、jquery局部刷新:
常见的有以下几种;
$.get方法,$.post方法,$.getJson方法,$.ajax方法。
前两种使用方法基本上一样。
function(data){
//回调方法。返回data数据。这里想怎么处理就怎么处理了。
});
$.getScript方法:
function(){
$(”#go”).click(function(){//回调方法
$(”.block”).animate( { backgroundColor: ‘pink’ }, 1000)
.animate( { backgroundColor: ‘blue’ }, 1000);
});
});
$.getJson只是返回的数据类型不一样:
function(data){
//注意,这里返回的JSON数据引用方法为”data.info”
});
$.ajax 方法:
type: “POST”, //提交的类型
url: “some.php”,//提交地址
data: “name=John&location=Boston”,//参数
success: function(msg){ //回调方法
alert( “Data Saved: ” + msg );//这里是方法内容,和上面的get方法一样
}
});
二、全页面刷新方法
window.location.reload()刷新当前页面.
parent.location.reload()刷新父亲对象(用于框架)
opener.location.reload()刷新父窗口对象(用于单开窗口)
top.location.reload()刷新最顶端对象(用于多开窗口)
您可能感兴趣的文章:
jquery刷新页面代码及js常用函数汇总
javascript刷新当前页面方法汇总
js自动刷新页面代码汇总
jQuery 定时局部刷新(setInterval)方法总结
asp网页自动刷新方法汇总
jquery刷新页面 jquery局部刷新与及全页面刷新
jquery刷新页面的实现代码(局部及全页面刷新)
PHP与jquery实时显示网站在线人数的例子
js刷新页面方法汇总
js自动刷新当前页面方法详解