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

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -