BubikolRamios
11-11-2010, 04:25 PM
Edit: digged out some old code , added blue lines, explanation ?
comments = new Comments("some text")
function Comments(jsp)
{
this.jsp = jsp;
var that = this;
this.save = function(obj)
{
alert(this.jsp);// pops out 'some text'
....
///call ajax ... catch response in catch_save
}
this.catch_save = function()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
alert(this.jsp);// pops out undefined
alert(that.jsp);// pops out 'some text' }
}
}
how come that there is undefined ?
comments = new Comments("some text")
function Comments(jsp)
{
this.jsp = jsp;
var that = this;
this.save = function(obj)
{
alert(this.jsp);// pops out 'some text'
....
///call ajax ... catch response in catch_save
}
this.catch_save = function()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
alert(this.jsp);// pops out undefined
alert(that.jsp);// pops out 'some text' }
}
}
how come that there is undefined ?