title: After ajax success show child table in if condition in ajax success
body: <pre><code>This is an HTML table with all buttons 
  </code></pre>
  <p>On click of a button in table row button, status has to be updated in backend PHP and in ajax success I have to display child table</p>
  <pre><code>&lt;table id=&quot;example&quot; class=&quot;stripe row-border order-column&quot; width=&quot;100%&quot;&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Drawing&lt;/th&gt;
        &lt;th style=&quot;display:none&quot;&gt;Overview&lt;/th&gt;
        &lt;th&gt;Stage&lt;/th&gt;
        &lt;th&gt;Status&lt;/th&gt;
        &lt;th&gt;Status&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
  
      &lt;tr id=&quot;1&quot;&gt;
        &lt;td&gt;&lt;button  type=&quot;button&quot; class=&quot;button clarify&quot; &gt;Clarify&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button allot&quot;&gt;Allott&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button start&quot;&gt;Started/Pused&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button correctit&quot;&gt;Quality Checking&lt;/button&gt;&lt;td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button send&quot;&gt;Send&lt;/button&gt;&lt;/td&gt;
      &lt;/tr&gt;
          &lt;tr id=&quot;2&quot;&gt;
        &lt;td&gt;&lt;button  type=&quot;button&quot; class=&quot;button clarify&quot; &gt;Clarify&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button allot&quot;&gt;Allott&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button start&quot;&gt;Started/Pused&lt;/button&gt;&lt;/td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button correctit&quot;&gt;Quality Checking&lt;/button&gt;&lt;td&gt;
        &lt;td&gt;&lt;button type=&quot;button&quot;  class=&quot;button send&quot;&gt;Send&lt;/button&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p>here is the ajax call each click on the button status has to update and if the button status or data is == 2 then I want to display the child table</p>
  <pre><code> 
  $(&quot;.button&quot;).click(function() {
    $this = $(this);
    //alert(&quot;am button&quot;);
    var drawingid = $(this).closest('tr').attr('id'); // table row ID 
    var stage_id = $(this).closest('tr').find('.button').val();
    // alert(stage_id);
    $.ajax({
      type: &quot;POST&quot;,
      url: &quot;stage2.php&quot;,
      dataType: &quot;json&quot;,
      data: {
        &quot;drawingID&quot;: drawingid,
        &quot;stage_ID&quot;: stage_id
  
      },
      success: function(data) {
        alert(data);
        if ( data == 2) {
        **//here if the data is == 2 then show child table with dropdown** $this.parent().parent().find('.button').val(data);
  $this.parent().parent().find('.button').html('Allott').addClass('allot').removeClass('clarify');
          var tr = $(this).closest('tr');
          id = $(this).closest('table').attr('id');
          table = $('#' + id).DataTable();
          var row = table.row(tr);
  
          // Open this row
          row.child(format(row.data(), id)).show();
          tr.addClass('shown');
        }  
      }
    });
  });
  </code></pre>