jQuery Ajax È«½âÎö
jQuery Ajax È«½âÎö
±¾ÎĶÌÖ·£ºhttp://s8.hk/0itq
<!--
.ajax div{
border: solid 1px red;
}
-->
// <![CDATA[
$(function(){
$("#btnajax").click(function(){
$.ajax({
type: "get",
url: "/rss",
beforeSend: function(XMLHttpRequest){
$('<div class="quick-alert">Êý¾Ý¼ÓÔØÖУ¬ÇëÉÔºó</div>')
.insertAfter( $("#btnajax") )
.fadeIn('slow')
.animate({opacity: 1.0}, 3000)
.fadeOut('slow', function() {
$(this).remove();
});
},
success: function(data, textStatus){
$(".ajax.ajaxResult").html("");
$("item",data).each(function(i, domEle){
$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");
});
},
complete: function(XMLHttpRequest, textStatus){
//HideLoading();
},
error: function(){
//ÇëÇó³ö´í´¦Àí
}
});
});
$("#btngetScript").click(function(){
$(this).attr("disabled","true");
$.getScript("http://files.cnblogs.com/QLeelulu/AjaxEvent.js", function(){
alert("AjaxEvent.js ¼ÓÔØÍê³É²¢Ö´ÐÐÍê³É.ÄãÔÙµã»÷ÉÏÃæµÄGet»òPost°´Å¥¿´¿´ÓÐʲô²»Í¬£¿");
$("#btnremoveScript").attr("disabled","");
});
});
$("#btnremoveScript").click(function(){
$(this).attr("disabled","true");
$("#btngetScript").attr("disabled","");
$("body").unbind();
});
$("#btnpost").click(function(){
$.post("http://qleelulu.atx41.idc800.net/jQuery/Ajax.aspx", { Action: "post", Name: "lulu" },
function (data, textStatus){
// data ¿ÉÒÔÊÇ xmlDoc, jsonObj, html, text, µÈµÈ.
//this; // Õâ¸öAjaxÇëÇóµÄÑ¡ÏîÅäÖÃÐÅÏ¢£¬Çë²Î¿¼jQuery.g
Ïà¹ØÎĵµ£º
Html´úÂ룺
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jquery ajax</title>
<link rel="stylesheet" type="text/css" media="screen"
......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<titl ......
ÏÖÔÚµÄÍøÒ³ÓÐÏ൱һ²¿·ÖÊDzÉÓÃÁËAJAX¼¼Êõ,²»¹ÜÊDzÉÓÃC#ÖеÄWebClient»¹ÊÇHttpRequest¶¼µÃ²»µ½ÕýÈ·µÄ½á¹û,ÒòΪÕâЩ½Å±¾ÊÇÔÚ·þÎñÆ÷·¢ËÍÍê±Ïºó²ÅÖ´ÐеÄ!
µ«ÎÒÃÇÓÃIEä¯ÀÀÒ³ÃæÊ±ÊÇÕý³£µÄ,ËùÒÔ½â¾ö·½·¨Ö»ÓÐ1¸ö¾ÍÊDzÉÓÃWebBrowser¿Ø¼þ
µ«ÊÇʹÓÃWebbrowserÄã»á·¢ÏÖ,ÔÚDownloadCompleteʼþÖÐ,Äã¸ù±¾ÎÞ·¨ÖªµÀÒ³ÃæºÎʱ²ÅËãÊÇÕæÕýµ ......
$(function(){
new AjaxUpload('file1', {
action: 'uploadpic.asp',
name: 'form1',
data:{act:'uploadfile',FormName:'form1'},
autoSubmit:false,
responseType:'json',
onSubmit:function(file,ext){
if (!(ext && /^(jpg|png|gif)$/i.test(ext))){
alert('ÇëÄúÉÏ´« ......