title: refreshing div with dynamically created data via ajax
body: <p>I'm trying to reload a <code>div</code> that has been dynamically created data via AJAX, but I'm getting a 403 forbidden error. Maybe something is wrong in what I am doing. Would you mind to helping me please. Thanks in advance.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="curr-elem"&gt;
      &lt;div class="box-header"&gt;
          &lt;h3&gt;Elementary Subject&lt;/h3&gt;
      &lt;/div&gt;
  
      &lt;div id="curr-elem-content"&gt;
          &lt;table id="curr-elem-tble"&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>var html;
  $.ajax({
      type: 'POST',
      url: 'add_subject.php',
      dataType: 'json',
      data: { 'func_numbr':'2' },
      success: function(data) {
          var activator;
          var disabler;
          var counter_sub = 0 ;
  
          $.each(data, function(i, item) {
              if (data[i].subj_status == "0") {
                  classToAddInactve = "inactiveButton";
                  DisableInactve = "disabled=\"disabled\""
                  classToAddActve = "";
                  DisableActve = ""
              }
              else {
                  classToAddInactve = ""
                  DisableInactve = ""
                  classToAddActve = "inactiveButton";
                  DisableActve = "disabled=\"disabled\""
              }
  
              html = "&lt;tr&gt;";
  
              html += "&lt;td&gt;&lt;lable&gt;Subject: &lt;/label&gt;&lt;input type='text' name='subject[" + counter_sub + "]' rel='" + data[i].subj_id + "' value='" + data[i].subj_name + "' readonly='readonly'&gt;&lt;/td&gt;";
              html += "&lt;td&gt;&lt;input type='button' rel='#loading-window' id='activate[" + counter_sub + "]' name='active' class='button active modal2 " + classToAddActve + "' value='Apply' " + DisableActve + "&gt; ";
              html += "&lt;input type='button' rel='#loading-window' id='inactivate["+counter_sub+"]' name='active' class='button inactive modal2 " + classToAddInactve + "' value='Remove from list' " + DisableInactve + "&gt;&lt;/td&gt;";
              html += "&lt;/tr&gt;";
  
              $('#curr-elem-tble').append(html);
  
              counter_sub = counter_sub +1;
          });
      }     
  });
  </code></pre>
  
  <p>JS that will trigger the <code>div</code> refresh:</p>
  
  <pre><code>$('.active').live('click', function() {
      var prev = $(this).parent().prev().find('input[type=text]');
      var valText = $(prev).val();
      var relVal = $(this).parent().prev().find('input[type=text]').attr('rel');
      var div = $(this).parent().parent().parent().parent().parent().attr('id');
  
      $("[id*="+div+"]").hide();
  
      $.ajax({
          type: 'POST',
          url: 'add_subject.php',
          dataType: 'json',
          data: {
              'func_numbr': '7',
              'subjct_name': valText,
              'subjct_id': relVal
          },
          success: function(data) {
              $('#mask2').hide();
              $('#loading-window').hide();
              $("[id*=" + div + "]").load("[id*=" + div + "]");
          }     
      });
  });
  </code></pre>