Get linkage with JavaScript

Source: Internet
Author: User

<script>//Linkage Query $ (function () {$ ("#BranchName"). Change (function () {var pa                Rent = $ ("#BranchName option:selected"). Val (); if (parent = "" && parent!=0) {$.ajax ({url: "/store/getstore?branch Id= "+ $ (" #BranchName option:selected "). Val (), type:" Get ", Success:functio N (data) {if (data).                                Data.length > 0) {var op = ""; for (var i = 0; i < data. Data.length; i++) {op + = "<option value=" + data. Data[i]. Id + ">" + data. Data[i].                                                            Dealername + "</option>"} $ ("#DealerName"). HTML (OP); } if (data. Data = = "") {var option = "<option></option>" $ ("#DealerName"). HTML (option);                }                            }                    });                    } else {eqlee.showwarring ("Please select a branch and reseller");                $ ("#DealerName"). HTML ("<option> please select </option>");        }            });    }); </script>

  

Above is the implementation of the linkage script

        Public Jsonresult GetStore (Guid branchid)        {            var data = new Models.returnjson () {Error = false};            var filter = string. Format ("Deleted = 0 and Branchid = ' {0} '", Branchid);            var Dealermodel = _blldealer.list (where:filter);            var id = dealermodel.select (x = x.id);            var dealername = dealermodel.select (x = x.dealername);            data = new Models.returnjson () {Error = false, data = Dealermodel};            return jsonnet (data, behavior:JsonRequestBehavior.AllowGet);        }

The above is the way to get linkage in the background

The above is the method to get linkage, because there is no time to write, only simple point.

Get linkage with JavaScript

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.