jquery multiselect ajax Dynamic Fetch data

Source: Internet
Author: User

1. Introduction of documents:

<link href= "Js/multiselect/jquery-ui.css" rel= "stylesheet" type= "Text/css"/>
<link href= "Js/multiselect/jquery.multiselect.css" rel= "stylesheet" type= "Text/css"/>
<script type= "Text/javascript" src= "Js/multiselect/jquery-ui.js" ></script>
<script type= "Text/javascript" src= "Js/multiselect/jquery.multiselect.js" ></script>


2. I realize the function of the province, city, district, Street, (the street needs more choice)

When the Drop-down box is initialized, the list of streets with multiple selection boxes in different regions is automatically refreshed

Main JS Code:

function Inittowns (e) {
		var areacode=$ ("#area_selt"). Val ();
		if (AreaCode) {
			$.post ("inittowns.html?method=" +areacode,function (data) {
				multiselect.empty ();
				For (index in data) {
					opt = $ (' <option/> ', {
						value:data[index].code,
						text:data[index].name
						
					}); C9/>opt.appendto (MultiSelect);
				}
				Multiselect.multiselect (' refresh ');
				
			}, "json");
		}
		
	

Description: Every time to get the data backstage: Mulitselect,empty () Empty the Drop-down box and then through the Refresh method to load the new data can be

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.