Sometimes we have the issue to pass a JavaScript function in a JSON response from the server and use it on the client side.
This blog will guide you how to pass a javascript function in a JSON response from the server and how you can use it at the client side.
Firstly, you have to know about the “reviver” function and also JSON.parse function working. As described in our previous blog
Let’s come to the main problem i.e. passing JavaScript function in JSON from the server side.
You have to create a json string at server side and put your json function in a string like -
Hope this helps
comments powered by Disqus