Ich schreibe eine Web-App, um Termine für einen Benutzer zu speichern, bisher wurde nur eine Funktion "Termin hinzufügen" implementiert. Der Fehler, den ich bekomme, ist, nachdem ich eine Liste aller Termine geladen habe und dann eine Klick-Funktion auf einem der Listenelemente verwendet, die Chrome-Konsole gibt mir diesen Fehler ... "Uncaught TypeError: this.appointmentClicked ist kein a Funktion“Uncaught TypeError: keine Funktion -JavaScript Cloud Computing
Code in Frage ....
$("#appointments li").click(function() {
// Call the appointmentClicked(...) function.
// The parameter is the ID of the appointment clicked.
// See how we get the ID from the located li element/tag.
appointmentClicked($(this).attr("id"));
dies ist die Funktion, die .... in der gleichen Datei definiert ...
function appointmentClicked(id) {
$("#appointments li").removeClass("selected"); //remove all list items from the class "selected, thus clearing previous selection
// Find the selected appointment (i.e. list item) and add the class "selected" to it.
// This will highlight it according to the "selected" class.
$("#" + id).addClass("selected");
//retrieve appointment coordinates from appointment service
var url = baseURL + "/appointment/" + id; //URL of service, notice that ID is part of URL path
//use jQuery shorthand Ajax function to get JSON data
$.getJSON(url, //URL of service
function(jsonData) //successful callback function
{
duration = jsonData["duration"]; //get duration from JSON data
owner = jsonData["owner"]; //get owner from JSON data
showappointment(duration, owner);
}
);
} //end function
Alle Hilfe ist willkommen:)
Jay
Anscheinend ist die „verlorene“ Funktion aus dem Anwendungsbereich des Anrufers ist. – Teemu
Sie öffnen/schließen Funktionen richtig? Sie sind in einem gleichen Umfang? –