======================================== =========== Part of the code: ================================ =================== Of course you must have this table in your database first, otherwise you will have no data...^_^
/** * Load city data * */ public void loadCity() { if (q == null || q.trim().equals("")) { write("noId"); } else { List citys = xzqhService.queryCitys(q.trim()); if (citys == null || citys.size() < 1) { write("null"); } else { StringBuilder builder = new StringBuilder("["); for (Xzqh city : citys) { builder.append("{'id':'"); builder.append(city.getCityId()); builder.append("','name':'"); builder.append(city.getCity()); builder.append("'},"); } if (builder.length() > 1) builder.replace(builder.length() - 1, builder.length(), "]"); write(builder.toString()); } } } /** * Load area data * */ public void loadRegion() { if (q == null || q.trim().equals("")) { write("noId"); } else { List citys = xzqhService.queryDistricts(q.trim()); if (citys == null || citys.size() < 1) { write("null"); } else { StringBuilder builder = new StringBuilder("["); for (Xzqh district : citys) { builder.append("{'id':'"); builder.append(district.getRegionId()); builder.append("','name':'"); builder.append(district.getRegion()); builder.append("'},"); } if (builder.length() > 1) builder.replace(builder.length() - 1, builder.length(), "]"); write(builder.toString()); } } }
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