In the development process, encountered a very many two-level linkage, the following is my summary of several two-level linkage cases
Two-stage linkage (1)
The first case is a relatively simple two-level linkage, using the display of jquery hidden to achieve, for less data of the two-level linkage can be adopted
Two-level linkage (2)-array
The second case is to use two-dimensional arrays to pass data, using JavaScript
Two-level linkage (3)-Ajax
The third case is using AJAX
Two-level linkage (3-1)-ajax/php
The third case is to use Ajax to get data from PHP
Php:
<?php
//For processing client request two-level linkage data
//1. Receive the province information sent by the client
$province = $_post[' provcince '];
2. Determine current province information, provide different city information
switch ($province) {case
' Shandong Province ':
Echo ' Qingdao, Jinan, Weihai, Rizhao, Dezhou ';
break;
Case ' Liaoning Province ':
Echo ' Shenyang, Dalian, Tieling, Dandong, Jinzhou ';
break;
Case ' Jilin Province ':
Echo ' Changchun, Songyuan, Jilin, Tonghua, Siping ';
break;
The server-side response is a string
?>
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.