Tôi có một JsFiddle here và thêm Microsoft AJAX để được tải thông qua phần JS/tài nguyên bên ngoài. Làm cách nào để biết mã JS của tôi có được chạy sau khi tệp AJAX đã tải xong không?Làm cách nào để tải tệp bên ngoài và đảm bảo rằng tệp chạy đầu tiên trong JSFiddle?
Dường như AJAX cũng không tải. :(
Đây là mã trong JSFiddle:
Type.registerNamespace("Tutorial.Chapter1");
Tutorial.Chapter1.Person = function(firstName, lastName) {
this._firstName = firstName;
this._lastName = lastName;
};
Tutorial.Chapter1.Person.prototype = {
set_firstName: function(value) {
this._firstName = value;
},
get_firstName: function() {
return this._firstName;
},
set_lastName: function(value) {
this._lastName = value;
},
get_lastName: function() {
return this._lastName;
},
_firstName: "",
_lastName: "",
displayName: function() {
alert("Hi! " + this._firstName + " " + this._lastName);
}
};
Tutorial.Chapter1.Person.registerClass("Tutorial.Chapter1.Person", null);
Bạn không thể dán mã MS sau mã của bạn thay vì sử dụng tùy chọn Thêm tài nguyên? – j08691
Tại sao bạn vẫn cần làm điều này? – j08691