Last thing to know when you learn web development is that you can move all of your JS and CSS code outside of the document so you can reuse it on other pages.
Create a main.js and a main.css file in your website folder (you can move them to other folders later).
Store the code inside the <script> tags in the main.js file. Do not include the tags themselves. In fact, you can now remove them.
Do the same for the <style> element in the main.css file.
Now, let’s reference them. Modify your <head> to include the following lines
<link rel="stylesheet" href="/main.css" /> <script src="/main.js"></script>
Now we can refresh our document. Notice two new files in our Network Panel. And, the AJAX call still works.
Let’s make a cool AJAX call response.