title: Navigation Bar and AJAX loading
body: <p>I have the following setup:</p>
  
  <p>A <strong>main-page.php</strong> that is consisted of:</p>
  
  <p>1) A header</p>
  
  <p>2) A nav bar</p>
  
  <p>3) Content (is loaded inside a <code>&lt;div id="dynamic-content"&gt;&lt;/div&gt;</code>)</p>
  
  <p>4) Footer</p>
  
  <p>Inside the nav bar you find several options (ex. About Us, Contact Us, etc..).</p>
  
  <p>Lets say that the script responsible for "<strong>About Us</strong>" is called <strong>about-us.php</strong>.</p>
  
  <p>What i want to achieve is to load the output of <strong>about-us.php</strong> page inside the content area (aka the dynamic-content div), as soon as i press the "About Us" button (#about-us div).</p>
  
  <p>In order to achieve this i use the following AJAX call:</p>
  
  <p><strong>AJAX Call</strong></p>
  
  <pre><code>$("#about-us").on('click', function(){
  
     $.ajax({
                url: "about-us.php",
                success: function(output){
  
                     $("#dynamic-content").html(output);
  
                }
           });
  
  });
  </code></pre>
  
  <p>Both <strong>main-page.php</strong> and <strong>about-us.php</strong> include their own CSS and JavaScript files:</p>
  
  <p><strong>main-page.js</strong> and <strong>main-page.css</strong> included in main-page.php</p>
  
  <p><strong>about-us.js</strong> and <strong>about-us.css</strong> included in about-us.php</p>
  
  <p><strong>THE QUESTION:</strong></p>
  
  <p>What is the correct way to use CSS and Javascript files of <strong>about-us.php</strong>?
  Should i include them inside the <strong>about-us.php</strong> script or include them inside the <strong>main-page.php</strong>?</p>
  
  <p>When i include them inside about-us.php i get an alert from console saying "<em>Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience</em>".</p>
  
  <p>At this point i have to mention that the about-us.js has more AJAX requests..</p>
  
  <p>Thanks in advance.</p>