1
我有以下代碼。如果我硬編碼鏈接它正確運行。如果我提醒鏈接,我會逐一獲取所有不同的短網址。但是,當我嘗試每個值傳遞到AJAX調用的代碼breaks..any幫助將不勝感激:如何使用Jquery在一個類上創建多個Ajax查詢
$(document).ready(function(){
//find all the shornened urls
$.each($('.shortenedUrl'), function(index, value) {
inline_stats_lookup(value);
});
function inline_stats_lookup(theLink)
{
alert(theLink);
//var theLink = "http://goo.gl/b9N1k";
$.post('http://qrcodes.weddingdecorationss.com/tracking/inline_statistics', {url: theLink}, function(response, status, xhr) {
if (status == 'error')
{
var msg = "Sorry but there was an error: ";
$("#results").html(msg + xhr.status + " " + xhr.statusText);
}
else
{
//$('.clicksAllTime').empty().append('<p>' + response[0].analytics.allTime.shortUrlClicks + '</p>');
//$('.clicksToday').empty().append('<p>' + response[0].analytics.day.shortUrlClicks + '</p>');
}
}, "json");
}
});
你確定你沒有尾隨空格或在警報未顯示特殊字符? – 2012-03-05 12:14:29