Double-layer ajax nesting (can be multi-layered) usage examples
This article mainly introduces the usage of double-layer ajax nesting (can be multi-layered), and analyzes the related usage skills of Ajax nesting with examples. It can realize the function of multi-layer nesting and has certain reference value. Friends in need You can refer to the example below
This article describes the usage of double-layer ajax nesting (can be multi-layered). Share it with everyone for your reference. The details are as follows:
function addbus()
{
//清除a标签中的所有元素
// $("#s1").remove();
var chooseIdTypeOne =$("#chooseIdTypeOne2").find("option:selected").val();
$.ajax({
url : "/ftcms/changeProject.do?getOriginal&OriginalName="+chooseIdTypeOne,
data : null, // 参数
type : "post",
cache : false,
dataType : "json", //返回json数据
error: function(){
//document.getElementById("chooseIdTypeOnechdranone").options.length = 0;
alert('error');
},
success:onchangecal
});
}
function onchangecal(data){
var chooseIdTypeOne =$("#chooseIdTypeOne2").find("option:selected").val();
document.getElementById("chooseIdTypeOnechdranone2").options.length = 0; //清空原有的option
var str="<option value='00000'>请选择</option>";
if(chooseIdTypeOne==1){
$.ajax({
url : "/ftcms/changeProject.do?getOriginal&OriginalName="+chooseIdTypeOne,
data : null, // 参数
type : "post",
cache : false,
dataType : "json", //返回json数据
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);
}The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Detailed explanation of ajax synchronization and asynchronousness in jquery
Ajax asynchronous upload in jquery
How to implement ASP.NET and Ajax
The above is the detailed content of Double-layer ajax nesting (can be multi-layered) usage examples. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undresser.AI Undress
AI-powered app for creating realistic nude photos
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undress AI Tool
Undress images for free
Clothoff.io
AI clothes remover
AI Hentai Generator
Generate AI Hentai for free.
Hot Article
Hot Tools
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
1384
52
Analyze the usage and classification of JSP comments
Feb 01, 2024 am 08:01 AM
Classification and Usage Analysis of JSP Comments JSP comments are divided into two types: single-line comments: ending with, only a single line of code can be commented. Multi-line comments: starting with /* and ending with */, you can comment multiple lines of code. Single-line comment example Multi-line comment example/**This is a multi-line comment*Can comment on multiple lines of code*/Usage of JSP comments JSP comments can be used to comment JSP code to make it easier to read
How to solve the 403 error encountered by jQuery AJAX request
Feb 20, 2024 am 10:07 AM
Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.
How to solve jQuery AJAX request 403 error
Feb 19, 2024 pm 05:55 PM
jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error
How to correctly use the exit function in C language
Feb 18, 2024 pm 03:40 PM
How to use the exit function in C language requires specific code examples. In C language, we often need to terminate the execution of the program early in the program, or exit the program under certain conditions. C language provides the exit() function to implement this function. This article will introduce the usage of exit() function and provide corresponding code examples. The exit() function is a standard library function in C language and is included in the header file. Its function is to terminate the execution of the program, and can take an integer
Usage of WPSdatedif function
Feb 20, 2024 pm 10:27 PM
WPS is a commonly used office software suite, and the WPS table function is widely used for data processing and calculations. In the WPS table, there is a very useful function, the DATEDIF function, which is used to calculate the time difference between two dates. The DATEDIF function is the abbreviation of the English word DateDifference. Its syntax is as follows: DATEDIF(start_date,end_date,unit) where start_date represents the starting date.
PHP and Ajax: Building an autocomplete suggestion engine
Jun 02, 2024 pm 08:39 PM
Build an autocomplete suggestion engine using PHP and Ajax: Server-side script: handles Ajax requests and returns suggestions (autocomplete.php). Client script: Send Ajax request and display suggestions (autocomplete.js). Practical case: Include script in HTML page and specify search-input element identifier.
How to solve the problem of jQuery AJAX error 403?
Feb 23, 2024 pm 04:27 PM
How to solve the problem of jQueryAJAX error 403? When developing web applications, jQuery is often used to send asynchronous requests. However, sometimes you may encounter error code 403 when using jQueryAJAX, indicating that access is forbidden by the server. This is usually caused by server-side security settings, but there are ways to work around it. This article will introduce how to solve the problem of jQueryAJAX error 403 and provide specific code examples. 1. to make
Detailed explanation and usage introduction of MySQL ISNULL function
Mar 01, 2024 pm 05:24 PM
The ISNULL() function in MySQL is a function used to determine whether a specified expression or column is NULL. It returns a Boolean value, 1 if the expression is NULL, 0 otherwise. The ISNULL() function can be used in the SELECT statement or for conditional judgment in the WHERE clause. 1. The basic syntax of the ISNULL() function: ISNULL(expression) where expression is the expression to determine whether it is NULL or


