title: Jquery replaceWith:replace one php file with another php file based on screen resolution
body: <p>I need to be able to replace a php file with another php file based on screen resolution. This is what I have so far: </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function adjustStyle(width) {
  width = parseInt(width);
  if (width = 1920) {
  $('book.php').replaceWith('book2.php');
  }
  }
  $(function() {
  adjustStyle($(this).width());
  $(window).resize(function() {
  adjustStyle($(this).width());
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>which obviously isn't working-- any ideas? Thank you in advance for any help received.</p>
  
  <p><em><strong>UPDATE</em></strong></p>
  
  <p>Is this at all close (to replace the book.php line)?</p>
  
  <pre><code> { $("a[href*='book.php']").replaceWith('href', 'book2.php'); }; 
  </code></pre>
  
  <p><em><strong>Second Update to reflect input gathered here</em></strong></p>
  
  <pre><code>function adjustStyle(width) {
  width = parseInt(width);
  if (width == 1920) {
  $('#bookinfo').replaceWith(['book2.php']);
  $.ajax({
   url: "book2.php",
   }).success(function ( data ) {
    $('#bookinfo').replaceWith(data);
  });
  $(function() {
  adjustStyle($(this).width());
  $(window).resize(function() {
  adjustStyle($(this).width());
  });
  });
  }
  }
  </code></pre>