Examples of double-layer ajax nesting (multi-layer) usage and ajax nested multi-layer instances

Source: Internet
Author: User

Examples of double-layer ajax nesting (multi-layer) usage and ajax nested multi-layer instances

This article describes the usage of double-layer ajax nesting (Multi-Layer. Share it with you for your reference. The details are as follows:

Function ad () {// clear all elements in the tag // $ ("# s1 "). remove (); var chooseIdTypeOne =one ("# chooseIdTypeOne2 "). find ("option: selected "). val (); $. ajax ({url: "/ftcms/changeProject. do? GetOriginal & OriginalName = "+ chooseIdTypeOne, data: null, // parameter type:" post ", cache: false, dataType:" json ", // return json data error: function () {// document. getElementById ("chooseIdTypeOnechdranone "). options. length = 0; alert ('error') ;}, success: onchangecal});} function onchangecal (data) {var chooseIdTypeOne =one ("# chooseIdTypeOne2 "). find ("option: selected "). val (); document. getElementById ("chooseIdType Onechdranone2 "). options. length = 0; // clear the original option var str = "<option value = '000000'> select </option>"; if (chooseIdTypeOne = 1) {$. ajax ({url: "/ftcms/changeProject. do? GetOriginal & OriginalName = "+ chooseIdTypeOne, data: null, // parameter type:" post ", cache: false, dataType:" json ", // return json data error: function () {// document. getElementById ("chooseIdTypeOnechdranone "). options. length = 0; alert ('error') ;}, success: onchangecal}) ;}} if (chooseIdTypeOne = 2) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 3) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 4) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 5) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 6) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 7) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 8) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 9) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 10) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 11) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 12) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}if (chooseIdTypeOne = 13) {for (var I = 0; I <data. length; I ++) {str + = "<option value = '" + data [I]. UID + "'>" + data [I]. NAME + "</option>" }}$ ("# chooseIdTypeOnechdranone2" ).html (str );}

I hope this article will help you with Ajax programming.

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.