title: MVC3 C# Razorview Printing a PartialView using Javascript
body: <p>I'm trying to have a button print a partial view.</p>
  
  <p>| Mainview | Partial View |</p>
  
  <p>| Users | Profile |</p>
  
  <p><br>
  On top of users I have links the user can click on to access his profile or his reports etc...
  I created a link  to print their profile with a Media Print CSS to make it look perfect on paper.</p>
  
  <p>The issue I'm having is making it work.</p>
  
  <pre><code>function print_url () {
    location: url;
    print();
  }
  &lt;li data-username="@Model.UserName"&gt;&lt;a href="javascript:print_url('URL/Home/ContentView?username=@Model.UserName')"&gt;Print Profile&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>This has to work for all browsers. Chrome just says no view available, firefox doesn't respond and IE nothing  :(.</p>
  
  <p>If you have any thoughts that would be great.</p>
  
  <p>AJAX</p>
  
  <pre><code>getUserData: function (elem) {
    $elem = $(elem).closest("[data-username]");
    var username = $elem.data("username");
    var profile = $elem.data("profile");
    var directReport = $elem.data("direct-report");
    $.ajax({
      url: 'Home/ContentView?username=' + username,
      type: 'GET',
      data: username,
      data: profile,
      data: directReport,
      beforeSend: function () {
        $('#loader').css('display', 'block');
      },
      success: function (result) {
        $("#content").html(result).scrollTop(result);
        //$("#tabs").fadeIn('1500');
        //console.log(result + '\n\n DONE');
      },
      error: function (e, msg) {
        //console.log(e, msg);
      }
    })
  </code></pre>