Injecting JavaScript into HTML
Once we have finished this section, we will have a not so pretty but fully functional main view where we can add, edit, and delete to do items using JavaScript to make calls to our Rust server. However, as you may recall, we did not add a delete
API endpoint. In order to inject JavaScript into our HTML, we will have to carry out the following steps:
- Create a
delete
item API endpoint. - Add a
JavaScript loading
function and replace the JavaScript tag in the HTML data with the loaded JavaScript data in the main item Rust view. - Add a JavaScript tag in the HTML file and add IDs to the HTML components so that we can reference the components in our JavaScript.
- Build a
rendering
function for our to-do items in JavaScript and bind it to our HTML via IDs. - Build a
button rendering
function in JavaScript based off item data for the ID. - Build an
API call
function in JavaScript to talk to the backend. - Build the
get
,delete
,edit
, and...