title: jQuery.Validation.Unobtrusive client side validation only works when scripts are on view page
body: <p>I have an <strong>ASP.NET MVC 4 App</strong> that uses the <strong>jQuery.validation.js</strong> plugin and MVC's <strong>jQuery.validation.unobtrusive.js</strong>. I use data annotations on my view model to validate a textbox's input to be an integer.</p>
  
  <p>This (nested) view is loaded within a parent view using...</p>
  
  <pre><code>&lt;% Html.RenderPartial("New"); %&gt;
  </code></pre>
  
  <p>One the first inital page load, client side validation works. But any reloading of the nested view with an ajax call, client side validation no longer works. Why is that?</p>
  
  <p><strong>Update</strong>: (Code example from <em>webdeveloper's</em> solution  below)</p>
  
  <pre><code>$.validator.unobtrusive.parse($('form'));
  </code></pre>
  
  <p>Example: </p>
  
  <pre><code>var saveAndUpdate = function (url) {
      var myForm = $('form', $('#TheDivThatContainsTheNewHTML'));
      $.ajax({
          url: url,
          type: 'POST',
          data: myForm.serialize(),
          success: function (result) {
              $('#TheDivThatContainsTheNewHTML').html(result);
              $.validator.unobtrusive.parse($('#TheDivThatContainsTheNewHTML'));          
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(xhr.status);
              alert(thrownError);
          },
          dataType: 'html'
      });
  }
  </code></pre>