這個是用JSON來做的AJAX的範例,值得好好參考
http://www.thinkpage.cn/weather/weather.aspx?uid=&c=CHXX0133&l=zh-CN&p=MSN&a=1&u=C&s=2&m=1&x=1&d=0&fc=&bgc=&bc=&ti=1&in=1&li=2
http://static.thinkpage.cn/weather/weather.js?v=11041102
$(document).ajaxStart(function (evt, xhr, opts) { isLoading = true; $("#tp-weather-widget #loading").fadeIn(); }); $(document).ajaxStop(function (evt, xhr, opts) { $("#tp-weather-widget #loading").fadeOut(); }); $(document).ajaxComplete(function (evt, xhr, opts) { isLoading = false; }); $(document).ajaxError(function (evt, xhr, opts, ex) { $("div[id$='weatherAJAX']").html("Error: " + error); });