私は新しいmyObjectというが作成されたときに、それは名前を見つけ、名前を持っていたら、その後のsayHelloを呼び出します...JavaScriptオブジェクト内のasp.netサーバーコールバックをどう対処しますか?
function myObject() {
this.hello = "hello";
var id = 1;
var name;
this.findName = function() {
alert(this.hello); //Displays "hello"
myServices.getName(id, this.sayHello);
}
this.sayHello = function(name) {
alert(this.hello); //Displays null <-- This is where I'm confused...
alert(name); //Displays the name retrieved from the server
}
this.findName();
}
をJavaScriptでオブジェクト内のwebMethodsにサーバーのコールバックを使用して、問題を抱えています発見されました。
サービスルーチンが機能し、正しい名前が返されます。
問題は、サーバーから名前が返され、this.sayHelloが呼び出された後も、同じオブジェクト内にあるようには見えません(同じmyObjectを参照していない名前はthis.helloがnullを返すので...
アイデア?