关于Jquery中的ajax请求 ,我并没做干的的说词,而是给出我自己做的实实在在的例子,供大家参考。
<script type="text/javascript" src ="jquery-1[1].2.6.js"></script>
<script >
function button1()
{
$("#demo").load("http://localhost/DedecmsV53/upload/");
}
function button2()
{
$.get("jquery.htm",function (uname){
document .getElementById ("demo").innerHTML =uname;
});
}
function button4()
{
$.post("jquery.htm",function (uname){
document .getElementById ("demo").innerHTML =uname;
});
}
function button3()
{
$.ajax({type: "GET",
url: "WebForm1.aspx"
});
}
function button5()
{
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
function(data){
$.each(data.items, function(i,item){$("<img/>").attr("src", item.media.m).appendTo("#demo");
if ( i == 3 ) return false;});});
}
function button6()
{
$.ajax({
contentType:"application/json",
type: "POST",
url: "WebService.asmx/HelloWorld",
data:"{'name':'张三'}",
dataType: 'json',
success: function(msq){
alert (msq.d);
}
});
}
$(function ()
{
$("div").css({color:"red"})//样式
});
</script>