Consuming RESTful services with jQuery
JQuery is a fast, light, and powerful JavaScript library; it eliminates DOM-related complexity by providing direct access to HTML elements once the DOM three has been loaded. To use jQuery within an HTML document, you have to import it:
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js "></script>
Assume that somewhere within an HTML document, there is a button defined as <input type="button" id="btnDelete" value="Delete"/>
.
To assign a function to the click event of this button with JQuery means we need to do the following:
- Import the jquery library in the HTML document
- Assure that the DOM document of the HTML document is completely loaded
- Access the button using the identifier defined by the ID attribute
- Provide a handler function as an argument to the
click
event:
$(document).ready(function() { $('#btn').click(function () { alert('Clicked'); }); });
The $('#identifier')
 expression provides direct...