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.