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

關(guān)于JavaScript跨域問(wèn)題及實(shí)時(shí)刷新解決方案

 更新時(shí)間:2014年06月09日 09:01:32   作者:  
在頁(yè)面顯示其他網(wǎng)站上面的數(shù)據(jù),需要用Ajax,就涉及到跨域問(wèn)題,下面有個(gè)示例,大家可以看看
在自己頁(yè)面顯示其他網(wǎng)站上面的數(shù)據(jù),需要用Ajax,就涉及到跨域問(wèn)題,

解決方案:jQuery.support.cors = true; (瀏覽器支持跨域訪(fǎng)問(wèn)),

實(shí)例:
復(fù)制代碼 代碼如下:

//瀏覽器支持跨域訪(fǎng)問(wèn)

jQuery.support.cors = true;
$.ajax({
url: "http://www.rj99999.com/Price/ListPrice.html",
dataType: 'html',
success: function (data, textStatus) {

//nowPrice為本頁(yè)面顯示數(shù)據(jù)控件,#price', data為從其他網(wǎng)站取出名為price的元素。
$("#nowPrice").text(jQuery('#price', data).html() + "元/克");
},
error: function (xhr, ajaxOptions, thrownError) {
$("#nowPrice").text("暫時(shí)無(wú)法顯示");
}
});
//實(shí)時(shí)刷新

//每60000毫秒/1分鐘調(diào)用togglecountdowntime()方法。

setTimeout("togglecountdowntime()", 60000);

相關(guān)文章

最新評(píng)論