The thinking of passing parameters onclick, then by clicking on the pop-up parameters. Not only to find
Directly on the code
$.each(s,function (key,value){ var text=""; for(i=0;i<value.LEVELS-1;i++){ text+="  " } $("#showDepar").append("<p onclick='test("+value.NAME+")'>"+text+value.NAME+"<br/></p>"); })
After this discovery did not use onclick
This allows the rear into the following method using the onclick
$.each(s,function (key,value){ var text=""; for(i=0;i<value.LEVELS-1;i++){ text+="  " } $("#showDepar").append("<p onclick='test(\""+value.NAME+"\")'>"+text+value.NAME+"<br/></p>"); })
With the escape character processing parameters, you can pass parameters of normal.
Reference: https: //blog.csdn.net/weixin_43187334/article/details/86506091