title: Jquery append MVC PartialView with scripts
body: <p>I have javascript function which appends <code>PartialView</code> into div. Everything works fine, except that PartialView contains some <code>&lt;script&gt;&lt;/script&gt;</code> scripts. And those dynamically appended functions are not found by jQuery - <code>Uncaught ReferenceError: getIDc4 is not defined</code>.</p>
  
  <p>My JS function</p>
  
  <pre><code>var url = '@UrlHelper.GetFullUrl("Inventories/GetFilterRow")'; //this returns partial view
          $.ajax({
              type: 'POST',
              data: { aRef: aRef },
              url: url,
              success: function(data) {
                  $('.filter').append($(data)[0]);
                  var script = document.createElement('script');
                  script.type = 'text/javascript';
                  script.src = url;
              }
          });
  </code></pre>
  
  <p>and partial view</p>
  
  <pre><code>...
  @{
      int id = Model != null ? Model.Id : 1;
  }
  
  &lt;div id="@Html.Raw("FilterCondition" + id)"&gt;
  ...
  ...
  ...
  
      @{
          string getIdcFunction = string.Format("getIDc{0}", id);
      }
      &lt;script&gt;
          @{
              @:function  
                  @getIdcFunction&lt;text&gt;() {
              var grid = $("@Html.Raw("#field"+id)").data("kendoDropDownList");
              var item = grid.value();
              return { IDc: item };
          }
              &lt;/text&gt;
          }
      &lt;/script&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>How can I get those dynamically appended functions get working?</p>
  
  <p>When I generate the partial view by using on page loading with </p>
  
  <pre><code>@Html.Partial("GetFilterRow", new {Id = 1})
  </code></pre>
  
  <p>everything works fine. The only problem is when this view is appendend via jquery and ajax. Then those functions are not found.</p>
  
  <p>Thanks for help.</p>