The following code already exists in one of the javascript files i am working , may i know what does the following do
Its jquery ajax , i saw the response result and its a json string which is manually created by the backend.
I want to know what is eval doing here
success: function (response) {
var response= response.replace(/\\/g, "%5C");
eval(response);
},
evalexecutes the passed in string as if it were javascript code.What exactly happens depends entirely on the contents of
response.That is, the value of the
responsevariable that is passed to theevalfunction gets evaluated as normal javascript.If
responsewas"alert('Hello from evel!');", you would see an alert box with the text “Hello from evel!”.