js_escape — Escape a value for use in javascript.¶
Summary¶
- js_escape($value)¶
Escape a value for use in javascript.
This is a convenience function for encoding a value using JSON notation. Must be used when interpolating PHP output in javascript. Note on usage: do not wrap the resulting output of this function in quotes, as proper JSON encoding will take care of that.
Parameters: - $value (string) –
Returns: string