javascript - how can i add a function to json object which has __type attribute? -


I am sending an object generated in a class from the server as a result of a web service call.

It is coming back with __type and it has other attributes from the server.

I want to add some functions to this object so that my files can be easily called.

How can I get this?

Thank you ...

OK if I tell you right then You can not add the function server to a function () back object, because you are not allowed to move the executable JavaScript code within the JSON object .

So you have to add that method / property after the object your client has created your javascript object like

  success: function (data) {data.my_new_method = function () {// yay! }},  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -