Javascript core_v2_encoding.JavascriptEncode() Issue

Hi,

We serializing data and receiving data using  $core_v2_encoding.JavascriptEncode() , I need to pass this received data to a Ajax call as JSON data. But always getting error. even I am passing one field I am getting same error. As per  my observation and analysis on error , Its seems like it returning html instead of JSON. But I am sending as JSON only. I've attached what I am receiving with this thread. But always getting error...

please guide me If I missed anything... Image 1. JSON  return data, Image 2  .vm contents  and image 3: C# return code.



Added info
[edited by: Muthu0604 at 6:54 AM (GMT 0) on Tue, Aug 17 2021]
Parents Reply
  • I'd try removing the HTML comment at the top (<!-- ... -->). That is still rendered in the result, and would be invalid JSON. Instead, you can use server-side comments with #* .... *# which would result in nothing in the contained comment being rendered. 

    Beyond that, I'd strongly recommend using JSM instead of VM for script-defined JSON callbacks. They're simpler, less error-prone, know how to natively return JSON-serialized objects, and have all the benefits of the full JavaScript language with access to the server-side script API. 

    When should I use Server-side Javascript? Server-side Javascript (identified with the extension .jsm) is one of the two languages used to implement server side scripts used by scripted customizations…
    Last edited in Verint Community 12.x > Developer Training

Children