Jquery+ajax data Loading .....

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<style>
* {margin:0; padding:0;}
body {font-size:12px;}
#loading {
width:80px;
height:20px;
Background: #bbb;
Color: #000;
Display:none;
}
#resText11
{
Border::solid 1px red;

width:100px; font-size:14px;
}
img{border:0;height:100px;width:100px;}
. comment {margin-top:10px; padding:10px; border:1px solid #ccc; background: #DDD;}
. Comment h6 {font-weight:700; font-size:14px;}
. para {margin-top:5px; Text-indent:2em;background: #DDD;}
</style>
<!--introducing jquery--
<script src= ". /scripts/jquery-1.3.1.js "type=" Text/javascript "></script>
<script>
$ (function ()
{
Demo1:
$ (' #send1 '). Click (Function ()
{
$.getjson ("Http://api.flickr.com/services/feeds/photos_public.gne?tags=car&tagmode=any&format=json &jsoncallback=? ",
function (data)
{
$ ("#resText1"). empty ();
$.each (Data.items, function (I,item)
{
$ ("if (i = = 3)
{
return false;
}
});
}
);
});
Demo2:
$ ("#send2"). Click (Function ()
{
$.get ("get1.asp",
{
Username: $ ("#username"). Val (),
Content: $ ("#content"). Val ()
}, function (data, textstatus)
{
$ ("#resText2"). HTML (data); Add the returned data to the page
}
);
})
Share these 2 global AJAX events
$ ("#loading"). Ajaxstart (function ()
{
$ (this). Show ();
$ ("#resText11"). Hide ();
$ ("#resText11"). HTML ("");
});
$ ("#loading"). Ajaxstop (function ()
{
$ (this). Hide ();
$ ("#resText11"). Show ();
$ ("#resText11"). HTML ("Picture loaded successfully");
});
})
</script>

<body>
<br/>
<div id= "Loading" > Loading in .......</div>
<br/>
Demo1:
<br/>
<input type= "button" id= "Send1" value= "Load"/>
<div id= "ResText1" ></div>
<div id= "resText11" ></div>

<br/>
Demo2:
<br/>
<form id= "Form1" >
<p> Reviews:</p>
<p> Name: <input type= "text" name= "username" id= "username"/></p>
<p> content: <textarea name= "Content" id= "content" ></textarea></p>
<p><input type= "button" id= "Send2" value= "Commit"/></p>
</form>
<div class= ' comment ' > reviews:</div>
<div id= "ResText2" >
</div>


</body>

Get1.asp

<%@ codepage=65001%>
<%
Dim username,content
Username=request. QueryString ("username")
Content=request. QueryString ("content")
Response. Write ("<div class= ' comment ' >

%>

Jquery+ajax data Loading .....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.