$json.isJSON
Check a string whether JSON
$json.isJSON( string )
element [string]
The string will be checked.
Notes
This function is used for check a string is JSON on $ajax().
Example
HTML code
<div id="box">{"John":{"age":20,"phone":"39-2039-492","email":"[email protected]"},"Tom":{"age":20,"phone":"39-2039-492","email":"[email protected]"}}</div> <button onclick="start_check()">start check</button>
JavaScript code
function start_check() { alert($json.isJSON($text($("box")))); }
Demonstration
{"John":{"age":20,"phone":"39-2039-492","email":"[email protected]"},"Tom":{"age":20,"phone":"39-2039-492","email":"[email protected]"}}