
Lab 11 was about changing text on a webpage using AJAX. What AJAX does is allow webpages to be updated without having to load the entire page. Using jQuery's .load() method, text from a .txt file can be loaded onto a webpage and change the page's content. The way I implemented this on my webpage's HTML was creating text between <p> tags with a special id and a button that would change the text using AJAX. I created a .txt file with text I wanted to replace the original text on my webpage. I linked my HTML to the jQuery library and created a document.ready() function in my script. This function called another function which attached a .click() function onto my button which itself attached the .load() function to my paragraph and took the name of my .txt file as a parameter, something necessary to load the new text. Now, whenever I clicked my button, the text from the .txt file would load instead of the default text.
These skills are important for a web designer because they allow a client who is not very skilled in coding to be able to change the content of the website themselves. A client may feel that in the long term, they mainly want to maintain the actual content of a site rather than the design, at least by themselves, however, they don't want to have to load the entire HTML in case they make a mistake and destroy their entire site. Using AJAX, it is possible for a less skilled client to edit the content of their site without having to code an actual HTML, making it convenient to maintain the site on the user end.
Comments
Post a Comment