PDA

View Full Version : Help in Objects and ajax



ferion
03-20-2009, 08:23 PM
Olla,

i got a problem with the usage of prototype (in script.aculo.us).
Here ist the Code Snippet



var sM_c = Class.create(
{
serverUrl : "http://theURL.org",

parseRequest: function (input)
{
this.sendRequest(input);
},
parseAnswer: function (response)
{
alert(response.status);
},

sendRequest: function (request)
{
this.handler = new Ajax.Request(this.serverUrl,
{
method : 'get',
onSuccess : function(helper)
{
this.parseAnswer(this); //<-----ProblemLine
}
});
},

initialize: function (caller,requesttype)
{
this.caller = caller;
this.parseRequest(requesttype);
this.initialized = true;
}
}
);


The script is requesting an external URL without problems. It enters the "onSuccess" block perfectly and the response contains the Server answer.
And now my Problem:
I don't want to use a native function to handle the response. I want to handle ist right in the same object the call ist comming from.
But I simply can't adress the object.
Does anybody now how to fix this problem?

thx
Ferion

P.S.
Please excuse my lack of proper english.