Servlet passes data string to foreground
The method used is
PrintWriter out = Response.getwriter ();
Response.sendredirect ("test.jsp");
String s = "[{' id ']: ' 1 ', ' pid ': ' 0 ', ' name ': ' test1 '},{' id ': ' One ', ' pid ': ' 1 ', ' name ': ' test11 '}, {' id ': ' + ', ' pid ': ' 1 ', ' name ' ': ' test12 '}, {' id ': ' 111 ', ' pId ': ' One ', ' name ': ' test111 '},] ";
Out.write (s);
----------------------
The superficial understanding of the. Get. Post. Ajax is
The last one is asynchronous, the first two are synchronous (blocked)
. Get (Url,data,function (data,status) {
The function that executes
I understand that the data and URL parameters mean the same thing.
})
-------------------------
Use of Ztree:
Note the differences in the format of the Ztree two JSON,
Often the simple format is to show the structure of the tree directly through the relationship between the data
The second is through the escaping of JSON.
Note that the style and JS files must be introduced into the full
Then the
The position on the interface is UL
Then the
Note that the passing response is passed back by the type string, which is the method of the string conversion object
var ss = eval ("(" + Data + ")");
var t = $ ("#test");
Then the tree-controlled initialization (location, configuration, data)
t = $.fn.ztree.init (t, setting, SS);
Get the tree object and manipulate it
var ztree = $.fn.ztree.getztreeobj ("test");
Collect and organize the data of the backstage to solve the problem of the foreground.
About
. Get replaced by
. Ajax
$ ("button"). Click (function () { $.get ("Demo_ajax_load.txt", function (Result) { $ ("div"). html (result); });});
------------
URL,
Data Success,
DataType });
About that. Get. Post. Ajax Ztree also has a background servlet passing data