Home >
Article > Web Front-end > Using jquery's ajax to implement a two-level interactive menu_javascript skills
Using jquery's ajax to implement a two-level interactive menu_javascript skills
WBOYOriginal
2016-05-16 17:11:101160browse
Menu resources are saved in the database. Using jquery's ajax implementation. The packages used are: json-lib-2.2.3-jdk15.jar ezmorph-1.0.6.jar json.js jquery.js
/** * des: Get the secondary linkage menu * autho:exceljava * date:Nov 20, 2009 * @return * @throws IOException */ public String getJsonCategory() throws IOException{ rfjsons=archiveService.getCategoryByParentID(parentId);//Get data from the database here net.sf.json.JSONArray jsonObj=net.sf.json.JSONArray.fromObject(rfjsons);//Assemble into json data sendMessage(jsonObj.toString());//push json data to the view return null; } /** * des: encapsulates sending data in json format back to js * autho:exceljava * date:Nov 20, 2009 * @param content * @throws IOException */ public void sendMessage(String content) throws IOException{ HttpServletResponse response = ServletActionContext.getResponse(); response.setCharacterEncoding("UTF-8"); response.getWriter().write(content);
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn