how can i use jquery and debug in liferay 7.4

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

hi 

i try use a js base on jqouery to show structurenize json.

<style type="text/css">

        #json-display {
            border: 1px solid #000;
            margin: 0;
            padding: 10px 20px;
        }
</style>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script type="text/javascript" src="./dist/jquery.json-editor.min.js"></script>
<script>
	window.renderJson = function (targetJson) {
		alert('2');
		alert(targetJson);
	    try {
	    	var editor = new JsonEditor('#json-display', JSON.parse(targetJson));
	    	editor.load(JSON.parse(targetJson));
	      } catch (ex) {
	        alert(ex);
	      }
  }
</script>

but when i trigger it, it shows

ReferenceError: JsonEditor is not defined

i do not know how to tracing the issue or debug, any suggestion?

thanks in advance
 

 

 

Lee Jordan, modified 3 Years ago. Expert Posts: 449 Join Date: 5/26/15 Recent Posts

jQuery is disabled by default. For 7.4 turn it on in Control Panel > System Settings > Third Party > jQuery


 

Hope this helps.

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

thank you very much, i will try it out and feedback the result