How can I get organisation unit information in DHIS2 data entry form?

<--script type="text/javascript">

dhis2.util.on( 'dhis2.de.event.formReady', function( event,aLpVgfXiz0f) {

var orgName= $( '#selectedOrganisationUnit' ).val();// From DHIS2 Selection Param
jQuery.get("https://play.dhis2.org/2.31dev/api/organisationUnits.json?query="+orgName+"&fields=id,level",function(json){
	$.each(json, function(key, value){

		var arr = [];
		for(var x in value){
		arr.push(value[x]);
		}
		var level =value[x]['level'];
		if(typeof level != 'undefined'){
		 console.log({level});
		}


   });
  });
});

<--/script>