Jump to content

re-defining a function within an object


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...