如何加载外部文件并确保其首先在JSFiddle中运行? [英] How do I load an external file and make sure that it runs first in JSFiddle?
本文介绍了如何加载外部文件并确保其首先在JSFiddle中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个JsFiddle 此处,并添加了要通过外部JS/加载的Microsoft AJAX.资源部分.如何知道AJAX文件加载完成后是否运行我的JS代码?
I have a JsFiddle here, and added Microsoft AJAX to be loaded through external JS/resource section. How can I tell whether or not my JS code is run after the AJAX file has finished loading?
似乎AJAX也不加载. :(
Seems that the AJAX does not load either. :(
这是JSFiddle中的代码:
Here is the code in the 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);
推荐答案
打开添加资源"部分,然后添加外部脚本的网址...
Open "Add Resources" section and add the url of your external script...
这篇关于如何加载外部文件并确保其首先在JSFiddle中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文