title: viewport & screen width & height values to PHP via AJAX request
body: <p>I want to get my viewport &amp; screen width &amp; height values to PHP. I found this link (<a href="http://css-tricks.com/screen-resolution-notequalto-browser-window/" rel="nofollow">http://css-tricks.com/screen-resolution-notequalto-browser-window/</a>) after quite much googleing.</p>
  
  <p>I tried to apply it with the code below but my issue is <strong>I am not redirected to body.php after execution of index.html</strong> so I can't get any <code>POST</code> value <strong>from index.html to body.php</strong>. I am sure that <strong>jquery.js</strong> is loaded. I also tried the script in <strong>header</strong> part after <strong>jquery.js</strong>.</p>
  
  <p>It seems that I couldn't achieve to make a proper request.</p>
  
  <p>I know nothing about javascript or AJAX coding unfortunately. I don't want to use google analytics api.</p>
  
  <p>I am using XAMPP for PHP execution.</p>
  
  <p>Can you please kindly clarify where I am wrong with correctness suggestion? thanks all</p>
  
  <p>My codes:</p>
  
  <p><em><strong>for index.html</em></strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
      &lt;head&gt;      
          &lt;meta charset=utf-8&gt;
          &lt;title&gt;my title&lt;/title&gt;
  
          &lt;!-- latest jquery library --&gt;
          &lt;script src="js/jquery.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
  &lt;body&gt;
          &lt;script&gt;
              $.ajax({
                type: "POST",
                url: "http://localhost/public_html/body.php",
                data: {
                  width        : $(window).width(),
                  height       : $(window).height(),
                  screen_width : screen.width,
                  screen_height: screen.height
                }
              });
          &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><em><strong>for body.php</em></strong></p>
  
  <pre><code>&lt;?php
  echo 'check print'.'&lt;br /&gt;';
  
  echo $_POST['width'].'&lt;br /&gt;';
  echo $_POST['height'].'&lt;br /&gt;';
  echo $_POST['screen_width'].'&lt;br /&gt;';
  echo $_POST['screen_height'].'&lt;br /&gt;';
  ?&gt;
  </code></pre>