让它工作。这是jQuery:
$('#findFiles').click(function() { // Locate HTML DOM element with ID "findFiless" and assign the following function to its "click" event...
chosenSite = document.getElementById("siteName").value;
searchVal = document.getElementById("searchFor").value;
searchTyp = document.getElementById("searchType").value;
$.get('FileSearchServlet', {siteName: chosenSite, searchFor: searchVal, searchType: searchTyp}, function(responseJson) { // Execute Ajax GET request on URL of "FileSearchServlet" and execute the following function with Ajax response JSON...
//-- toClient
var resultsToClientNode = $("#tree").dynatree("getTree").selectKey("resultsToClient");
resultsToClientNode.removeChildren();
toClientFilenames = responseJson.toClient; //0-N filenames
$.each(responseJson.toClient, function() {
resultsToClientNode.addChild({
title: this
});
});
...
这是响应中的 JSON(使用 Firebug > Net > XHR 来查看):
fromClient
["O_TE015308_XX_343_182754070041.OLD", "O_TE015308_XX_343_182755030040.OLD", "O_TE015308_XX_353_131142014034.OLD"]
toLab
[]
fromLab
[]
toClient
["R_TE015308_XX_340_154659.OLD"]