title: Open a particular accordion div after ajax call
body: <p>I am submitting some values to database through ajax and i want to reload and open a particular accordion div after ajax call.</p>
  
  <p>This is what i was trying and it doesn't work=</p>
  
  <pre><code>    function submit(id) {
      var submitID = '#' + id + 'submit';
      var divId = '#' + id + 'myDiv';
      $.ajax({
          'url' : base_url + controller + '/add_val',
          'type' : 'POST',
          data : { var: $(submitID).val()             
          },
          'success': function (data) {
               $("#divId").html(data);
               $("#divId").load(window.location + divId);
               $("#accordion").accordion("option", "active", $("#accordion div").index(divId));
           }
  
      });
      }
  </code></pre>
  
  <p>HTML code is here:</p>
  
  <pre><code>&lt;div id="accordion"&gt;
    &lt;?php  foreach ($divKey as $val): ?&gt;
      &lt;h3&gt;&lt;?php echo $val-&gt;name; ?&gt;&lt;/h3&gt;
      &lt;div id="&lt;?php echo $val-&gt;id . "myDiv"; ?&gt;"&gt;
          &lt;select class="s2_select" id="&lt;?php echo $val-&gt;id . "submit"; ?&gt;"  name=""&gt;
             &lt;option&gt;value 1&lt;/option&gt;
             &lt;option&gt;value 2&lt;/option&gt;
             &lt;option&gt;value 3&lt;/option&gt;
          &lt;/select&gt;
       &lt;input type="button" class="btn btn-default" value="Add" onClick="submit(&lt;?php echo $val-&gt;id; ?&gt;)"&gt;
      &lt;ul&gt;
      &lt;li&gt;....&lt;/li&gt;
      &lt;/ul&gt;                                           
      &lt;/div&gt;   
    &lt;?php endforeach; ?&gt;
  &lt;/div&gt;
  </code></pre>