ajaxit, a simple ajax wrapper for CRUD
✓ Published0🌍 Public
Aandrewfulrich
Last edited May 6, 2017
Created on May 6, 2017
This example demonstrates ajaxit, a lightweight JavaScript wrapper that simplifies AJAX requests for CRUD operations. It shows how the wrapper exposes methods like `ajaxIt.get`, `ajaxIt.create`, `ajaxIt.update`, and `ajaxIt.delete`, each built on the core `doIt` function. The code uses the native `XMLHttpRequest` API, handling different HTTP methods (GET, POST, PUT, DELETE) and expected status codes, while supporting form data submission through the `FormData` constructor. It also resolves relative paths against `window.location.origin`, making it suitable for same-origin requests without additional configuration.
AI-generated description