欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery中頁(yè)面Ajax方法$.load的功能使用介紹

 更新時(shí)間:2014年10月20日 15:43:12   投稿:whsnow  
load可以做到加載一個(gè)頁(yè)面的時(shí)候,如果發(fā)生錯(cuò)誤,根據(jù)statusText給出的狀態(tài),顯示對(duì)應(yīng)的提示,這對(duì)用戶(hù)來(lái)說(shuō)非常重要

load語(yǔ)法

$(".selector").load("url", function(responseText, statusText, xmlhttprequest));

可以做到加載一個(gè)頁(yè)面的時(shí)候,如果發(fā)生錯(cuò)誤,根據(jù)statusText給出的狀態(tài),顯示對(duì)應(yīng)的提示,這對(duì)用戶(hù)來(lái)說(shuō)非常重要。

例子,load post

代碼如下

復(fù)制代碼 代碼如下:

<div id=btnAjaxPost>點(diǎn)擊我</div>
<div id=divResult>內(nèi)容加載中</div>

$("#btnAjaxPost").click(function(event)
{
var username = $("#username").val();
//發(fā)送Post請(qǐng)求
$("#divResult").load("$(www.dbjr.com.cn){ctx}/jqueryLoad", { "username": username});
});


例子,load get方法

代碼如下

復(fù)制代碼 代碼如下:

<div id=in_head>內(nèi)容加載中</head>
<script language="javascript">$('#in_head').load('ajaxlogin.php?cityid=1208');</script>

Ajax方法$.load亂碼

一般引起load亂碼是由于二者頁(yè)面編碼不致影起的,處理方法是

1.我的顯示頁(yè)面index.html的編碼是uft-8的;
2.我的靜態(tài)頁(yè)面foot.html的編碼是uft-8的;

$("#index_foot_container").load("foot.html");

相關(guān)文章

最新評(píng)論