Je continue d'essayer d'appeler la fonction getMonthDay. Je passe un paramètre pubDate et continue d'obtenir l'erreur - Break on ErrorXCopyDisableContinue this.getMonthDay n'est pas une fonctionaide avec la syntaxe littérale - pas une fonction
Des idées?
$(document).ready(function(){
alert = console.log;
var ns = {
init : function(){
$.ajax({
url: '/calendar/RSSSyndicator.aspx?type=N&number=15&category=8-0%2c4-0%2c6-0%2c10-0%2c7-0%2c17-0%2c16-0%2c9-0%2c5-0%2c3-0%2c2-0&department=3&numdays=31&ics=Y&rsstitle=Annandale+-+Event+Listing&rssid=11',
success: this.loaded
});
},
loaded: function(data){
// Find item from the RSS document and iterate over reach one.
$(data).find('item').each(function(i, value){
// Set the title and get rid of all chars including and between()
var title = $(this).find('title').text().replace(/\w+\s+\(.*?\)/, "");
var link = $(this).find('link').text();
var pubDate = $(this).find('pubDate').text();
alert(title);
alert(link);
alert(pubDate);
test = this.getMonthDay(pubDate);
$('#events').append("<p>" + title + "<br/>" + link + "</p>");
});
// var t = items[0].getElementsByTagName('title');
// alert(t[0].firstChild.nodeValue);
},
getMonthDay : function(pubDate){
var d = new Date(pubDate);
d.month = d.getMonth();
var months = ["January", "February", "March", "Thursday", "Friday", "Saturday", "Sunday"];
var month = months[d.month]
var newMonthDay = month + " " + d.getDay();
return newMonthDay;
}
}
ns.init();
});
J'appelle correctement la méthode? test = this.getMonthDay (pubDate); – steve
Non. C'est l'erreur. Voir ma réponse ci-dessous. – VoteyDisciple