Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.



Get Started Now!

How to use multiple Api in Ajax JQuery HTTP requests ?

In this tutorial im going to solve how to use multiple api HTTP request in one ajax success functions.

Solution:-

$(document).on('click', '.verification_token', function() {
    console.log('working edit button');
    $('#name_form').show();
    var id = $(this).attr('id');
    $('#form_result').html('');

$.ajax({
    type: "GET",
    data: {},
    url: "{{ url('/api/v1/j/webaccess/edit/') }}/" + id,
    headers: {
        "Authorization": "Bearer " + localStorage.getItem('a_u_a_b_t')
    },
    success: function(html) {
        console.log('value aa gaya edit ke page pe 1');
        console.log(html);
        var task = html.data.type_of_task;
        var emails = html.data.email_address;
        console.log("task yehi hai 1");
        console.log(task);
        console.log('email address me kya aa rha hai' + emails);
        var pwd = html.data.password;
    if (emails === null) {
        console.log('empty task me in kr gye hai');
        // Call another route or perform desired actions
        $.ajax({
            type: "GET",
            data: {},
            url: "{{ url('/api/v1/j/webaccess/bulkedit/') }}" + id,
            headers: {
                "Authorization": "Bearer " + localStorage.getItem(
                    'a_u_a_b_t')
            },
            success: function(data) {
                console.log(
                    'success bulk wala me in kr gye hai' +
                    data);
                // $('#myformModal_bulk').modal('show');
                $('#mywebsite_id').val(html.data.website);
                $('#tasktype_getting').val(html.data.website);
                console.log('website me kya aa rh hai' + html
                    .data.website);
                $('#uploadtoken_bulk').html(html.data
                    .token_engineer);
                console.log('upload token me kya aa rha hai' +
                    html.data.token_engineer);
                console.log(
                    'check kro token id me kya aa rha hai' +
                    html.data.tokenid);
                $('.modal-title-bulk').text("Bulk key");
                $('.modal-title_delete').text("Assets Delete");
                // $('#action_button').val("Update");
                // $('#action_button_bulk').val("Update");
                $('#mytoken_engineer_bulk').val(html.data
                    .token_engineer);
                $('#myid_bulk').val(html.data.id);
                $('#mytokenid_bulk').val(html.data.tokenid);
                console.log('id mera hai' + html.data.id);
                // $('#action_bulk').val("Update");
                $('#action_button_bulk').val("Update");
                $('#action_bulk').val("Update");
                $('#profile_hidden_id_bulk').val(id);
                $('#hidden_id_bulk').val(id);
                $('#myformModal_bulk').modal('show');
                // $('#myformModal').modal('show');

            },
            error: function(xhr, status, error) {
                // $('#addProfileModal').modal('show');

                console.log(
                    'bulk wala me error me in kr gye hai');
            }
        });
    } else if (pwd === null) {
        console.log('password me in kr gye hai' + pwd);
        $('#staticBackdrop').modal('show');
    } else {
        $('#mytype_of_task').val(html.data.type_of_task);
        $('#mywebsite').val(html.data.website);
        $('#myemail_address').val(html.data.email_address);
        $('#myproject_manager').val(html.data.maintenance_engineer);
        $('#mypassword').val(html.data.password);
        $('#myuser_name').val(html.data.user_name);
        $('#mywizard_project_name').val(html.data.wizard_project_name);
        $('#myadmin_email').val(html.data.admin_email);
        $('#myadmin_id').val(html.data.admin_id);
        $('#mytoken_engineer').val(html.data.token_engineer);
        $('#uploadtoken').html(html.data.token_engineer);
        $('#mytokenid').val(html.data.tokenid);
        $('#myid').val(html.data.id);
        $('.modal-title').text("Upload private key to decrypt 1");
        $('.modal-title_delete').text("Assets Delete");
        $('#action_button').val("Update");
        $('#action').val("Update");
        $('#myformModal').modal('show');
        $('#hidden_id').val(id);
    }
    }
});
});

Output:-

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

Basics of C Programming

Structure of a C Program Definition: A C program follows a structured format, which includes essential components like preprocessor directives, the main function, and statements. Structure Breakdown:…

Explore Rewa with Ease: Book Bikes and Cars Online with Motoshare

Rewa, the cultural heart of Madhya Pradesh, is a city that offers an enticing blend of history, natural beauty, and cultural richness. Whether you’re visiting to explore…

Explore Shimoga with Ease: Book Bikes and Cars Seamlessly on Motoshare

Shimoga, often called the “Gateway to Malnad,” is a stunning blend of natural beauty, cultural richness, and serene landscapes. Whether you’re planning to explore its mesmerizing waterfalls,…

Discover Mathura with Ease: Rent Bikes & Cars Seamlessly with Motoshare

Mathura, the birthplace of Lord Krishna, is a city rich in heritage and spiritual significance. Whether you’re a devotee, history enthusiast, or curious traveler, Mathura has something…

Discover Nizamabad with Ease: Rent Bikes and Cars through Motoshare

Explore the charm of Nizamabad effortlessly with Motoshare’s newly launched bike and car rental services. Whether you’re planning a quick trip across the city or a day…

Discover Tumakuru with Ease: Book Bikes and Cars Seamlessly on Motoshare

Tumakuru, a vibrant city in Karnataka, is a treasure trove of natural beauty, cultural heritage, and thrilling experiences. With Motoshare’s newly launched bike and car rental services,…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x