S
ssouthwe
Guest
Now and then in WebSpeed, we find it convenient to output the value of ABL variables or fields into JavaScript. For example: script var myString = '`customer.name`'; /script The problem with the above is that if customer.name contains an apostrophe or backslash, you could have problems with the way that JavaScript will interpret it. Backslash is a control character PHP language has a function called JSON-Encode() that will just return the JSON representation of a variable. I know ABL has some ways to turn temp-tables or datasets into JSON, but is there a simple way to do this with the ABL for a character variable? e.g.: script var myString = `json-encode(customer.name)`; /script I have rolled my own types of functions for this over the years, but just wondered if there was a better way.
Continue reading...
Continue reading...