Jump to content

re-defining a function within an object


wongadob

Recommended Posts

Hi, I have a javascript object that has been pre-defined using a constructor function. One of the elements of the object is a success function. This success function is an ajax server get success call, but can be too different functions dependant on how it is set up. The line I know is wrong is the following, but I do not know how it should be set.

ajaxfunc.success = updateCacheAndDisplay(feed);

ajaxfunc is the objectsuccess should hold the function I wish to call on success updateCacheAndDisplay is the function that I want to be called on success.feed is the data I also want passed, although this is not essential just now. I could set ajaxfunc.data=feed or something similar and access it via this.data in the function (I think) So the main issue is how to I set ajaxfunc.success to point be the updateCacheAndDisplay function. Thanks PS Object & OOP & Javascript newbie so please be gentle.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...