Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

197
Views
How to get ajax response values from different ajax request response? or any other way?

I have a form having dependent drop down list like brands, category and product and for single row I am having all 3 list from 3 ajax request response but in new row using addrow how I can call or get 3 different ajax response value under one?

for example based on brand category comes like

$.ajax({
        url: 'php_action/fetchDropdownProductData.php',  // category depend on brand name
        type: 'post',
        data: {brandId : brandId},
        dataType: 'json',
        success:function(response) {
            var html = '<option value="">Select Category</option>';
            response.forEach(category => {
                 html += "<option value='" + category.categories_id + "'>"+ category.categories_name +"</option>"
                 $("#productCategories"+row).html(html);
            })
        } // /success
    }); // /ajax function to fetch the product data

and for addrow ajax

$.ajax({
        url: 'php_action/fetchProductData.php',
        type: 'post',
        dataType: 'json',
        success:function(response) {
            $("#addRowBtn").button("reset");            

            var tr = '<tr id="row'+count+'" class="'+arrayNumber+'">'+
                 // start of productBands on addrows                
                '<td>'+
                    '<div class="form-group">'+
                     // here is the wrong I am doing...
                    '<select class="form-control" name="productBrand[]" id="productBrand'+count+'" onchange="getProductData1('+count+')" >'+
                        '<option value="">~~SELECT~~</option>';

            $.each(response, function(index, value) {
                tr += '<option value="'+value[0]+'">'+value[1]+'</option>';                         
            });
                                                    
            tr += '</select>'+
                '</div>'+
            '</td>'+
11 months ago ยท Santiago Trujillo
Answer question
Find remote jobs