Two-layer Ajax nested (multi-layer) Usage instance _ajax related to

Source: Internet
Author: User

The examples in this article describe two-tier Ajax nesting (multiple layers) usage. Share to everyone for your reference. as follows:

function Addbus () {//Clear all elements//$ ("#s1") in a label. Remove ();
  var chooseidtypeone =$ ("#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 ("Chooseidty
  Peonechdranone "). options.length = 0;  
  Alert (' Error '); 
  }, success:onchangecal});
   function onchangecal (data) {var chooseidtypeone =$ ("#chooseIdTypeOne2"). Find ("option:selected"). Val (); document.getElementById ("ChooseIdTypeOnechdranone2"). options.length = 0;
  Empty the original option var str= "<option value= ' 00000 ' > Please select </option>"; if (chooseidtypeone==1) {$.ajax ({url: "/ftcms/changeproject.do?getoriginal&originalname=" +chooseIdTypeOne, DA Ta: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 V Alue= ' "+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++) {St r+= "<option value= '" +data[i]. Uid+ "' >" +data[i].name+ "</option>"} if (chooseidtypeone==11) {for (Var i=0;i<data.length;i++) {St r+= "<option value= '" +data[i]. Uid+ "' >" +data[i].name+ "</option>"} if (chooseidtypeone==12) {for (Var i=0;i<data.length;i++) {St r+= "<option value= '" +data[i]. Uid+ "' >" +data[i].name+ "</option>"} if (chooseidtypeone==13) {for (Var i=0;i<data.length;i++) {St r+= "<option value= '" +data[i]. Uid+ "' >" +data[i].name+ "</option>"} $ ("#chooseIdTypeOnechdranone2"). HTML (STR);

 }

I hope this article will help you with your 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.