đ āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ⧍: HTTP Methods āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ
đ āĻāĻ āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ⧠āϝāĻž āĻļāĻŋāĻāĻŦā§āύ:
- â
hx-get– āĻĄā§āĻāĻž āĻāύāĻžāϰ āĻāύā§āϝ - â
hx-post– āĻĄā§āĻāĻž āĻĒāĻžāĻ āĻžāύā§āϰ āĻāύā§āϝ - â
hx-put– āĻĄā§āĻāĻž āĻāĻĒāĻĄā§āĻ āĻāϰāĻžāϰ āĻāύā§āϝ - â
hx-delete– āĻĄā§āĻāĻž āĻŽā§āĻā§ āĻĢā§āϞāĻžāϰ āĻāύā§āϝ - â
hx-patch– āĻāĻāĻļāĻŋāĻ āĻāĻĒāĻĄā§āĻā§āϰ āĻāύā§āϝ - â āĻā§āύ Method āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ
đ¯ āĻŽā§āϞ āĻŦāĻŋāώāϝāĻŧ:
- HTTP Methods āĻāϰ āĻĒāĻžāϰā§āĻĨāĻā§āϝ
- RESTful API concepts
- Request/Response handling
âąī¸ āϏāĻŽāϝāĻŧ: ā§Ēā§Ģ-ā§Ŧā§Ļ āĻŽāĻŋāύāĻŋāĻ | đ āĻĒā§āϰāϝāĻŧā§āĻāύ: āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ā§§ āϏāĻŽā§āĻĒāύā§āύ
â ī¸ āĻĒā§āϰā§āĻŦāĻļāϰā§āϤ:
- āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ā§§ āϏāĻŽā§āĻĒāύā§āύ āĻāϰāϤ⧠āĻšāĻŦā§
- Live Server setup āĻāϰāĻž āĻĨāĻžāĻāϤ⧠āĻšāĻŦā§
- HTMX āĻāϰ basic concepts āĻāĻžāύāϤ⧠āĻšāĻŦā§
đ HTTP Methods āĻāĻŋ āĻāĻŦāĻ āĻā§āύ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ?
đ¤ HTTP Methods āĻāϰ āϏāĻāĻā§āĻāĻž:
HTTP Methods āĻšāϞ āĻŦāĻŋāĻāĻŋāύā§āύ āϧāϰāύā§āϰ requests āϝāĻž āĻāĻŽāϰāĻž server āĻ āĻĒāĻžāĻ āĻžāĻāĨ¤ āĻĒā§āϰāϤāĻŋāĻāĻŋ method āĻāϰ āĻāϞāĻžāĻĻāĻž āĻāĻĻā§āĻĻā§āĻļā§āϝ āĻāĻŦāĻ āĻāĻžāĻ āϰāϝāĻŧā§āĻā§āĨ¤ āĻāĻā§āϞ⧠web āĻāϰ āĻŽā§āϞ āĻāĻŋāϤā§āϤāĻŋ āĻāĻŦāĻ RESTful API āĻāϰ āĻ āĻāĻļāĨ¤
đ¯ āĻā§āύ āĻŦāĻŋāĻāĻŋāύā§āύ Methods āĻĒā§āϰāϝāĻŧā§āĻāύ?
- āϏā§āĻĒāώā§āĻāϤāĻž: āĻā§āύ āϧāϰāύā§āϰ operation āĻāϰāĻž āĻšāĻā§āĻā§ āϤāĻž āĻŦā§āĻāĻž āϝāĻžāϝāĻŧ
- āύāĻŋāϰāĻžāĻĒāϤā§āϤāĻž: āĻŦāĻŋāĻāĻŋāύā§āύ method āĻāϰ āĻāϞāĻžāĻĻāĻž security implications
- Caching: āĻāĻŋāĻā§ method cache āĻšāϝāĻŧ, āĻāĻŋāĻā§ āĻšāϝāĻŧ āύāĻž
- Idempotency: āĻāĻŋāĻā§ method āĻāĻāĻžāϧāĻŋāĻāĻŦāĻžāϰ āĻāĻžāϞāĻžāϞā§āĻ same result
đ HTTP Methods āĻāϰ āϏāĻāĻā§āώāĻŋāĻĒā§āϤ āϤā§āϞāύāĻž:
| Method | āĻāĻžāĻ | āύāĻŋāϰāĻžāĻĒāĻĻ | Idempotent | Cache |
|---|---|---|---|---|
| GET | āĻĄā§āĻāĻž āĻāύāĻž | â āĻšā§āϝāĻžāĻ | â āĻšā§āϝāĻžāĻ | â āĻšā§āϝāĻžāĻ |
| POST | āĻĄā§āĻāĻž āϤā§āϰāĻŋ | â āύāĻž | â āύāĻž | â āύāĻž |
| PUT | āϏāĻŽā§āĻĒā§āϰā§āĻŖ āĻāĻĒāĻĄā§āĻ | â āύāĻž | â āĻšā§āϝāĻžāĻ | â āύāĻž |
| DELETE | āĻĄā§āĻāĻž āĻŽā§āĻā§ āĻĢā§āϞāĻž | â āύāĻž | â āĻšā§āϝāĻžāĻ | â āύāĻž |
| PATCH | āĻāĻāĻļāĻŋāĻ āĻāĻĒāĻĄā§āĻ | â āύāĻž | â āύāĻž | â āύāĻž |
đĨ hx-get – āĻĄā§āĻāĻž āĻāύāĻžāϰ āĻāύā§āϝ
đ¯ hx-get āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ:
đ āĻāĻŋ āĻāϰā§:
- Server āĻĨā§āĻā§ data/content retrieve āĻāϰā§
- Page reload āĻāĻžāĻĄāĻŧāĻžāĻ content load āĻāϰā§
- āϏāĻŦāĻā§āϝāĻŧā§ common āĻāĻŦāĻ āύāĻŋāϰāĻžāĻĒāĻĻ HTTP method
- Browser cache āĻāϰāϤ⧠āĻĒāĻžāϰā§
đ§ āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ:
- â Page content load āĻāϰāĻžāϰ āĻāύā§āϝ
- â Search results āĻĻā§āĻāĻžāύā§āϰ āĻāύā§āϝ
- â User profile information āĻāύāĻžāϰ āĻāύā§āϝ
- â Product details load āĻāϰāĻžāϰ āĻāύā§āϝ
- â Navigation menu items load āĻāϰāĻžāϰ āĻāύā§āϝ
đģ Practical Examples:
đš Example 1: Simple Content Loading
<!-- Main HTML -->
<button hx-get="user-profile.html"
hx-target="#profile-section"
hx-indicator="#loading">
đ¤ āĻĒā§āϰā§āĻĢāĻžāĻāϞ āĻĻā§āĻā§āύ
</button>
<div id="loading" style="display: none;">âŗ āϞā§āĻĄ āĻšāĻā§āĻā§...</div>
<div id="profile-section">āĻāĻāĻžāύ⧠āĻĒā§āϰā§āĻĢāĻžāĻāϞ āĻĻā§āĻāĻžāĻŦā§</div>
đ user-profile.html:
<div style="background: #e8f5e8; padding: 20px; border-radius: 8px;">
<h3>đ¤ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āϰ āĻĒā§āϰā§āĻĢāĻžāĻāϞ</h3>
<p><strong>āύāĻžāĻŽ:</strong> āĻŽā§āĻšāĻžāĻŽā§āĻŽāĻĻ āϰāĻšāĻŋāĻŽ</p>
<p><strong>āĻāĻŽā§āĻāϞ:</strong> rahim@example.com</p>
<p><strong>āϝā§āĻāĻĻāĻžāύ:</strong> ā§§ā§Ģ āĻāĻžāύā§āϝāĻŧāĻžāϰāĻŋ, ⧍ā§Ļ⧍ā§Ē</p>
</div>
đš Example 2: Search Functionality
<input type="text"
name="search"
placeholder="āĻĒāĻŖā§āϝ āĻā§āĻāĻā§āύ..."
hx-get="search-results.html"
hx-target="#search-results"
hx-trigger="keyup changed delay:500ms"
hx-indicator="#search-loading">
<div id="search-loading" style="display: none;">đ āĻā§āĻāĻāĻāĻŋ...</div>
<div id="search-results">āĻāĻāĻžāύ⧠āϏāĻžāϰā§āĻ āϰā§āĻāĻžāϞā§āĻ āĻĻā§āĻāĻžāĻŦā§</div>
đš Example 3: Dynamic Navigation
<nav>
<a href="#" hx-get="home-content.html" hx-target="#main-content">đ āĻšā§āĻŽ</a>
<a href="#" hx-get="about-content.html" hx-target="#main-content">âšī¸ āĻāĻŽāĻžāĻĻā§āϰ āϏāĻŽā§āĻĒāϰā§āĻā§</a>
<a href="#" hx-get="contact-content.html" hx-target="#main-content">đ āϝā§āĻāĻžāϝā§āĻ</a>
</nav>
<main id="main-content">
āĻŽā§āϞ āĻāύā§āĻā§āύā§āĻ āĻāĻāĻžāύ⧠āϞā§āĻĄ āĻšāĻŦā§
</main>
đ¤ hx-post – āĻĄā§āĻāĻž āĻĒāĻžāĻ āĻžāύā§āϰ āĻāύā§āϝ
đ¯ hx-post āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ:
đ āĻāĻŋ āĻāϰā§:
- Server āĻ āύāϤā§āύ data āĻĒāĻžāĻ āĻžāϝāĻŧ
- Form submission āĻāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻšāϝāĻŧ
- Data body āϤ⧠āĻĒāĻžāĻ āĻžāϝāĻŧ, URL āĻ āύāϝāĻŧ
- Cache āĻšāϝāĻŧ āύāĻž
đ§ āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ:
- â Form submit āĻāϰāĻžāϰ āĻāύā§āϝ
- â āύāϤā§āύ user registration
- â Comment/review submit āĻāϰāĻžāϰ āĻāύā§āϝ
- â File upload āĻāϰāĻžāϰ āĻāύā§āϝ
- â Login/authentication āĻāϰ āĻāύā§āϝ
đģ Practical Examples:
đš Example 1: Contact Form
<form hx-post="submit-contact.html"
hx-target="#form-response"
hx-indicator="#form-loading">
<div style="margin: 10px 0;">
<label>āύāĻžāĻŽ:</label>
<input type="text" name="name" required
style="width: 100%; padding: 8px; margin-top: 5px;">
</div>
<div style="margin: 10px 0;">
<label>āĻāĻŽā§āĻāϞ:</label>
<input type="email" name="email" required
style="width: 100%; padding: 8px; margin-top: 5px;">
</div>
<div style="margin: 10px 0;">
<label>āĻŦāĻžāϰā§āϤāĻž:</label>
<textarea name="message" required
style="width: 100%; padding: 8px; margin-top: 5px; height: 100px;"></textarea>
</div>
<button type="submit"
style="background: #28a745; color: white; padding: 10px 20px; border: none; border-radius: 5px;">
đ§ āĻŦāĻžāϰā§āϤāĻž āĻĒāĻžāĻ āĻžāύ
</button>
</form>
<div id="form-loading" style="display: none;">đ¤ āĻĒāĻžāĻ āĻžāύ⧠āĻšāĻā§āĻā§...</div>
<div id="form-response"></div>
đ submit-contact.html:
<div style="background: #d4edda; padding: 20px; border-radius: 8px; border-left: 4px solid #28a745; margin-top: 15px;">
<h3>â
āĻŦāĻžāϰā§āϤāĻž āϏāĻĢāϞāĻāĻžāĻŦā§ āĻĒāĻžāĻ āĻžāύ⧠āĻšāϝāĻŧā§āĻīŋŊīŋŊ!</h3>
<p>āϧāύā§āϝāĻŦāĻžāĻĻ! āĻāĻŽāϰāĻž āĻļā§āĻā§āϰāĻ āĻāĻĒāύāĻžāϰ āϏāĻžāĻĨā§ āϝā§āĻāĻžāϝā§āĻ āĻāϰāĻŦāĨ¤</p>
<p><strong>āĻĒāĻžāĻ āĻžāύā§āϰ āϏāĻŽāϝāĻŧ:</strong> <span id="submit-time"></span></p>
<script>
document.getElementById('submit-time').textContent = new Date().toLocaleString('bn-BD');
</script>
</div>
đš Example 2: User Registration
<form hx-post="register-user.html"
hx-target="#registration-result"
hx-indicator="#reg-loading">
<h3>đ¤ āύāϤā§āύ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āϤā§āϰāĻŋ āĻāϰā§āύ</h3>
<input type="text" name="username" placeholder="āĻāĻāĻāĻžāϰāύā§āĻŽ" required
style="width: 100%; padding: 10px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px;">
<input type="email" name="email" placeholder="āĻāĻŽā§āĻāϞ" required
style="width: 100%; padding: 10px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px;">
<input type="password" name="password" placeholder="āĻĒāĻžāϏāĻāϝāĻŧāĻžāϰā§āĻĄ" required
style="width: 100%; padding: 10px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px;">
<button type="submit"
style="width: 100%; background: #007bff; color: white; padding: 12px; border: none; border-radius: 5px; margin-top: 10px;">
đ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āϤā§āϰāĻŋ āĻāϰā§āύ
</button>
</form>
<div id="reg-loading" style="display: none; text-align: center; margin: 10px 0;">
âŗ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āϤā§āϰāĻŋ āĻšāĻā§āĻā§...
</div>
<div id="registration-result"></div>
đš Example 3: Quick Comment System
<div style="background: #f8f9fa; padding: 15px; border-radius: 8px; margin: 10px 0;">
<h4>đŦ āĻŽāύā§āϤāĻŦā§āϝ āĻāϰā§āύ</h4>
<form hx-post="add-comment.html"
hx-target="#comments-list"
hx-swap="beforeend"
hx-indicator="#comment-loading">
<textarea name="comment" placeholder="āĻāĻĒāύāĻžāϰ āĻŽāύā§āϤāĻŦā§āϝ āϞāĻŋāĻā§āύ..." required
style="width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; height: 80px;"></textarea>
<div style="margin-top: 10px;">
<input type="text" name="author" placeholder="āĻāĻĒāύāĻžāϰ āύāĻžāĻŽ" required
style="padding: 8px; border: 1px solid #ddd; border-radius: 4px; margin-right: 10px;">
<button type="submit"
style="background: #17a2b8; color: white; padding: 8px 16px; border: none; border-radius: 4px;">
đŦ āĻŽāύā§āϤāĻŦā§āϝ āĻĒā§āϏā§āĻ āĻāϰā§āύ
</button>
</div>
</form>
<div id="comment-loading" style="display: none; margin-top: 10px;">
đ āĻŽāύā§āϤāĻŦā§āϝ āĻĒā§āϏā§āĻ āĻšāĻā§āĻā§...
</div>
</div>
<div id="comments-list">
<!-- Existing comments will be here -->
</div>
đ hx-put – āĻĄā§āĻāĻž āĻāĻĒāĻĄā§āĻ āĻāϰāĻžāϰ āĻāύā§āϝ
đ¯ hx-put āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ:
đ āĻāĻŋ āĻāϰā§:
- āĻŦāĻŋāĻĻā§āϝāĻŽāĻžāύ resource āϏāĻŽā§āĻĒā§āϰā§āĻŖāĻāĻžāĻŦā§ replace āĻāϰā§
- Idempotent – āĻāĻāĻžāϧāĻŋāĻāĻŦāĻžāϰ āĻāĻžāϞāĻžāϞā§āĻ same result
- āĻĒā§āϰ⧠object/record update āĻāϰā§
- RESTful API āĻāϰ āĻ āĻāĻļ
đ§ āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ:
- â User profile āϏāĻŽā§āĻĒā§āϰā§āĻŖ update āĻāϰāĻžāϰ āĻāύā§āϝ
- â Product information āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻāϰāĻžāϰ āĻāύā§āϝ
- â Settings/Configuration update āĻāϰāĻžāϰ āĻāύā§āϝ
- â Complete record replacement āĻāϰ āĻāύā§āϝ
âī¸ PUT vs POST āĻāϰ āĻĒāĻžāϰā§āĻĨāĻā§āϝ:
- PUT: Existing resource update āĻāϰā§
- POST: āύāϤā§āύ resource āϤā§āϰāĻŋ āĻāϰā§
- PUT: Idempotent (āĻāĻāĻžāϧāĻŋāĻāĻŦāĻžāϰ āĻāĻžāϞāĻžāϞā§āĻ same result)
- POST: Non-idempotent (āĻĒā§āϰāϤāĻŋāĻŦāĻžāϰ āύāϤā§āύ result)
đģ Practical Examples:
đš Example 1: Profile Update
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px;">
<h3>đ¤ āĻĒā§āϰā§āĻĢāĻžāĻāϞ āĻāĻĒāĻĄā§āĻ āĻāϰā§āύ</h3>
<form hx-put="update-profile.html"
hx-target="#profile-status"
hx-indicator="#update-loading">
<div style="margin: 10px 0;">
<label>āĻĒā§āϰā§āĻŖ āύāĻžāĻŽ:</label>
<input type="text" name="fullname" value="āĻŽā§āĻšāĻžāĻŽā§āĻŽāĻĻ āϰāĻšāĻŋāĻŽ" required
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px;">
</div>
<div style="margin: 10px 0;">
<label>āĻāĻŽā§āĻāϞ:</label>
<input type="email" name="email" value="rahim@example.com" required
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px;">
</div>
<div style="margin: 10px 0;">
<label>āĻĢā§āύ:</label>
<input type="tel" name="phone" value="+ā§Žā§Žā§Ļā§§ā§ā§§ā§¨ā§Šā§Ēā§Ģā§Ŧā§ā§Ž"
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px;">
</div>
<div style="margin: 10px 0;">
<label>āĻ āĻŋāĻāĻžāύāĻž:</label>
<textarea name="address"
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px; height: 60px;">āĻĸāĻžāĻāĻž, āĻŦāĻžāĻāϞāĻžāĻĻā§āĻļ</textarea>
</div>
<button type="submit"
style="background: #ffc107; color: #212529; padding: 10px 20px; border: none; border-radius: 5px; font-weight: bold;">
đ āĻĒā§āϰā§āĻĢāĻžāĻāϞ āĻāĻĒāĻĄā§āĻ āĻāϰā§āύ
</button>
</form>
<div id="update-loading" style="display: none; margin-top: 10px;">
đ āĻāĻĒāĻĄā§āĻ āĻšāĻā§āĻā§...
</div>
<div id="profile-status"></div>
</div>
đ update-profile.html:
<div style="background: #fff3cd; padding: 15px; border-radius: 8px; border-left: 4px solid #ffc107; margin-top: 15px;">
<h4>â
āĻĒā§āϰā§āĻĢāĻžāĻāϞ āϏāĻĢāϞāĻāĻžāĻŦā§ āĻāĻĒāĻĄā§āĻ āĻšāϝāĻŧā§āĻā§!</h4>
<p>āĻāĻĒāύāĻžāϰ āϏāĻŽāϏā§āϤ āϤāĻĨā§āϝ āϏāĻāϰāĻā§āώāĻŋāϤ āĻšāϝāĻŧā§āĻā§āĨ¤</p>
<ul>
<li>â āĻŦā§āϝāĻā§āϤāĻŋāĻāϤ āϤāĻĨā§āϝ āĻāĻĒāĻĄā§āĻ āĻšāϝāĻŧā§āĻā§</li>
<li>â āϝā§āĻāĻžāϝā§āĻā§āϰ āϤāĻĨā§āϝ āϏāĻāϰāĻā§āώāĻŋāϤ āĻšāϝāĻŧā§āĻā§</li>
<li>â āĻ āĻŋāĻāĻžāύāĻž āĻāĻĒāĻĄā§āĻ āĻšāϝāĻŧā§āĻā§</li>
</ul>
<p><strong>āĻāĻĒāĻĄā§āĻā§āϰ āϏāĻŽāϝāĻŧ:</strong> <span id="update-time"></span></p>
<script>
document.getElementById('update-time').textContent = new Date().toLocaleString('bn-BD');
</script>
</div>
đš Example 2: Product Information Update
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px;">
<h3>đĻ āĻĒāĻŖā§āϝā§āϰ āϤāĻĨā§āϝ āĻāĻĒāĻĄā§āĻ āĻāϰā§āύ</h3>
<form hx-put="update-product.html"
hx-target="#product-status"
hx-indicator="#product-loading">
<input type="hidden" name="product_id" value="123">
<div style="margin: 10px 0;">
<label>āĻĒāĻŖā§āϝā§āϰ āύāĻžāĻŽ:</label>
<input type="text" name="product_name" value="āϏā§āĻŽāĻžāϰā§āĻ āĻĢā§āύ" required
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px;">
</div>
<div style="margin: 10px 0;">
<label>āĻĻāĻžāĻŽ (āĻāĻžāĻāĻž):</label>
<input type="number" name="price" value="25000" required
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px;">
</div>
<div style="margin: 10px 0;">
<label>āĻŦāĻŋāĻŦāϰāĻŖ:</label>
<textarea name="description" required
style="width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px; height: 80px;">āĻāĻā§āĻ āĻŽāĻžāύā§āϰ āϏā§āĻŽāĻžāϰā§āĻ āĻĢā§āύ, āĻĻā§āϰā§āĻĻāĻžāύā§āϤ āĻā§āϝāĻžāĻŽā§āϰāĻž āĻāĻŦāĻ āĻĻā§āϰā§āĻāϏā§āĻĨāĻžāϝāĻŧā§ āĻŦā§āϝāĻžāĻāĻžāϰāĻŋ āϏāĻšāĨ¤</textarea>
</div>
<button type="submit"
style="background: #17a2b8; color: white; padding: 10px 20px; border: none; border-radius: 5px;">
đĻ āĻĒāĻŖā§āϝā§āϰ āϤāĻĨā§āϝ āĻāĻĒāĻĄā§āĻ āĻāϰā§āύ
</button>
</form>
<div id="product-loading" style="display: none; margin-top: 10px;">
đĻ āĻĒāĻŖā§āϝā§āϰ āϤāĻĨā§āϝ āĻāĻĒāĻĄā§āĻ āĻšāĻā§āĻā§...
</div>
<div id="product-status"></div>
</div>
đī¸ hx-delete – āĻĄā§āĻāĻž āĻŽā§āĻā§ āĻĢā§āϞāĻžāϰ āĻāύā§āϝ
đ¯ hx-delete āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ:
đ āĻāĻŋ āĻāϰā§:
- Server āĻĨā§āĻā§ resource āϏā§āĻĨāĻžāϝāĻŧā§āĻāĻžāĻŦā§ āĻŽā§āĻā§ āĻĢā§āϞā§
- Idempotent – āĻāĻāĻžāϧāĻŋāĻāĻŦāĻžāϰ āĻāĻžāϞāĻžāϞā§āĻ same result
- āϏāĻžāĻŦāϧāĻžāύ⧠āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤ⧠āĻšāϝāĻŧ āĻāĻžāϰāĻŖ data permanently delete āĻšāϝāĻŧ
- āϏāĻžāϧāĻžāϰāĻŖāϤ confirmation āĻĒā§āϰāϝāĻŧā§āĻāύ
đ§ āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ:
- â User account delete āĻāϰāĻžāϰ āĻāύā§āϝ
- â Post/Comment remove āĻāϰāĻžāϰ āĻāύā§āϝ
- â File delete āĻāϰāĻžāϰ āĻāύā§āϝ
- â Shopping cart item remove āĻāϰāĻžāϰ āĻāύā§āϝ
â ī¸ āύāĻŋāϰāĻžāĻĒāϤā§āϤāĻž āĻŦāĻŋāĻŦā§āĻāύāĻž:
- Confirmation: āϏāĻŦāϏāĻŽāϝāĻŧ user confirmation āύāĻŋāύ
- Authorization: User āĻāϰ permission check āĻāϰā§āύ
- Backup: Important data āĻāϰ backup āϰāĻžāĻā§āύ
- Soft Delete: Permanent delete āĻāϰ āĻĒāϰāĻŋāĻŦāϰā§āϤ⧠soft delete consider āĻāϰā§āύ
đģ Practical Examples:
đš Example 1: Delete with Confirmation
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #dee2e6;">
<h4>đ āĻāĻŽāĻžāϰ āĻĒā§āϏā§āĻ</h4>
<p>HTMX āĻĻāĻŋāϝāĻŧā§ Modern Web Development</p>
<p><small>āĻĒā§āϰāĻāĻžāĻļāĻŋāϤ: ā§§ā§Ģ āĻāĻžāύā§āϝāĻŧāĻžāϰāĻŋ, ⧍ā§Ļ⧍ā§Ē</small></p>
<div style="margin-top: 15px;">
<button hx-delete="delete-post.html"
hx-target="#post-container"
hx-confirm="āĻāĻĒāύāĻŋ āĻāĻŋ āύāĻŋāĻļā§āĻāĻŋāϤ āϝ⧠āĻāĻ āĻĒā§āϏā§āĻāĻāĻŋ āĻŽā§āĻā§ āĻĢā§āϞāϤ⧠āĻāĻžāύ? āĻāĻāĻŋ āϏā§āĻĨāĻžāϝāĻŧā§āĻāĻžāĻŦā§ āĻŽā§āĻā§ āϝāĻžāĻŦā§āĨ¤"
hx-indicator="#delete-loading"
style="background: #dc3545; color: white; padding: 8px 16px; border: none; border-radius: 4px;">
đī¸ āĻĒā§āϏā§āĻ āĻŽā§āĻā§ āĻĢā§āϞā§āύ
</button>
<button style="background: #6c757d; color: white; padding: 8px 16px; border: none; border-radius: 4px; margin-left: 10px;">
âī¸ āϏāĻŽā§āĻĒāĻžāĻĻāύāĻž āĻāϰā§āύ
</button>
</div>
<div id="delete-loading" style="display: none; margin-top: 10px; color: #dc3545;">
đī¸ āĻŽā§āĻā§ āĻĢā§āϞāĻž āĻšāĻā§āĻā§...
</div>
</div>
đ delete-post.html:
<div style="background: #f8d7da; padding: 20px; border-radius: 8px; border-left: 4px solid #dc3545; text-align: center;">
<h4 style="color: #721c24;">â
āĻĒā§āϏā§āĻ āϏāĻĢāϞāĻāĻžāĻŦā§ āĻŽā§āĻā§ āĻĢā§āϞāĻž āĻšāϝāĻŧā§āĻā§</h4>
<p style="color: #721c24;">āĻāĻĒāύāĻžāϰ āĻĒā§āϏā§āĻāĻāĻŋ āϏā§āĻĨāĻžāϝāĻŧā§āĻāĻžāĻŦā§ āĻŽā§āĻā§ āĻĢā§āϞāĻž āĻšāϝāĻŧā§āĻā§āĨ¤</p>
<p style="color: #721c24;"><small>āĻŽā§āĻā§ āĻĢā§āϞāĻžāϰ āϏāĻŽāϝāĻŧ: <span id="delete-time"></span></small></p>
<script>
document.getElementById('delete-time').textContent = new Date().toLocaleString('bn-BD');
</script>
</div>
đš Example 2: Shopping Cart Item Removal
<div id="cart-items">
<div class="cart-item" style="background: #f8f9fa; padding: 15px; margin: 10px 0; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<h5>đą āϏā§āĻŽāĻžāϰā§āĻ āĻĢā§āύ</h5>
<p>āĻĻāĻžāĻŽ: ⧍ā§Ģ,ā§Ļā§Ļā§Ļ āĻāĻžāĻāĻž | āĻĒāϰāĻŋāĻŽāĻžāĻŖ: ā§§āĻāĻŋ</p>
</div>
<button hx-delete="remove-cart-item.html"
hx-target="closest .cart-item"
hx-swap="outerHTML"
hx-confirm="āĻāĻ āĻĒāĻŖā§āϝāĻāĻŋ āĻāĻžāϰā§āĻ āĻĨā§āĻā§ āϏāϰāĻŋāϝāĻŧā§ āĻĢā§āϞāĻŦā§āύ?"
style="background: #dc3545; color: white; padding: 5px 10px; border: none; border-radius: 4px;">
â āϏāϰāĻžāύ
</button>
</div>
<div class="cart-item" style="background: #f8f9fa; padding: 15px; margin: 10px 0; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<h5>đģ āϞā§āϝāĻžāĻĒāĻāĻĒ</h5>
<p>āĻĻāĻžāĻŽ: ā§Ģā§Ģ,ā§Ļā§Ļā§Ļ āĻāĻžāĻāĻž | āĻĒāϰāĻŋāĻŽāĻžāĻŖ: ā§§āĻāĻŋ</p>
</div>
<button hx-delete="remove-cart-item.html"
hx-target="closest .cart-item"
hx-swap="outerHTML"
hx-confirm="āĻāĻ āĻĒāĻŖā§āϝāĻāĻŋ āĻāĻžāϰā§āĻ āĻĨā§āĻā§ āϏāϰāĻŋāϝāĻŧā§ āĻĢā§āϞāĻŦā§āύ?"
style="background: #dc3545; color: white; padding: 5px 10px; border: none; border-radius: 4px;">
â āϏāϰāĻžāύ
</button>
</div>
</div>
đ remove-cart-item.html:
<!-- Empty response - item will be removed from DOM -->
đĄ āĻāĻŋāĻĒ: āĻāĻ āĻā§āώā§āϤā§āϰ⧠empty response āĻĒāĻžāĻ āĻžāύ⧠āĻšāϝāĻŧ āĻāĻžāϰāĻŖ hx-swap="outerHTML" āĻĻāĻŋāϝāĻŧā§ āĻĒā§āϰ⧠element replace āĻšāϝāĻŧā§ āϝāĻžāϝāĻŧāĨ¤
đ§ hx-patch – āĻāĻāĻļāĻŋāĻ āĻāĻĒāĻĄā§āĻā§āϰ āĻāύā§āϝ
đ¯ hx-patch āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ:
đ āĻāĻŋ āĻāϰā§:
- Resource āĻāϰ āĻļā§āϧā§āĻŽāĻžāϤā§āϰ āύāĻŋāϰā§āĻĻāĻŋāώā§āĻ āĻ āĻāĻļ update āĻāϰā§
- PUT āĻāϰ āĻā§āϝāĻŧā§ efficient āĻāĻžāϰāĻŖ āĻļā§āϧ⧠changed data āĻĒāĻžāĻ āĻžāϝāĻŧ
- Partial updates āĻāϰ āĻāύā§āϝ ideal
- Network bandwidth save āĻāϰā§
đ§ āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ:
- â Status change āĻāϰāĻžāϰ āĻāύā§āϝ (Active/Inactive)
- â Like/Unlike button āĻāϰ āĻāύā§āϝ
- â Priority/Rating change āĻāϰāĻžāϰ āĻāύā§āϝ
- â Single field update āĻāϰāĻžāϰ āĻāύā§āϝ
âī¸ PATCH vs PUT āĻāϰ āĻĒāĻžāϰā§āĻĨāĻā§āϝ:
- PATCH: āĻļā§āϧ⧠changed fields āĻĒāĻžāĻ āĻžāϝāĻŧ
- PUT: āϏāĻŽā§āĻĒā§āϰā§āĻŖ resource āĻĒāĻžāĻ āĻžāϝāĻŧ
- PATCH: Bandwidth efficient
- PUT: Complete replacement
đģ Practical Examples:
đš Example 1: Status Toggle
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #dee2e6;">
<h4>đ¤ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§: āĻŽā§āĻšāĻžāĻŽā§āĻŽāĻĻ āϰāĻšāĻŋāĻŽ</h4>
<p>āĻāĻŽā§āĻāϞ: rahim@example.com</p>
<p>āϝā§āĻāĻĻāĻžāύ: ā§§ā§Ģ āĻāĻžāύā§āϝāĻŧāĻžāϰāĻŋ, ⧍ā§Ļ⧍ā§Ē</p>
<div style="margin-top: 15px;">
<span>āϏā§āĻā§āϝāĻžāĻāĻžāϏ: </span>
<span id="user-status" style="background: #28a745; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px;">
â
āϏāĻā§āϰāĻŋāϝāĻŧ
</span>
<button hx-patch="toggle-status.html"
hx-target="#user-status"
hx-indicator="#status-loading"
style="background: #ffc107; color: #212529; padding: 6px 12px; border: none; border-radius: 4px; margin-left: 10px;">
đ āϏā§āĻā§āϝāĻžāĻāĻžāϏ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻāϰā§āύ
</button>
<div id="status-loading" style="display: none; margin-top: 5px; font-size: 12px; color: #6c757d;">
đ āϏā§āĻā§āϝāĻžāĻāĻžāϏ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻšāĻā§āĻā§...
</div>
</div>
</div>
đ toggle-status.html:
<span style="background: #dc3545; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px;">
â āύāĻŋāώā§āĻā§āϰāĻŋāϝāĻŧ
</span>
đš Example 2: Like/Unlike System
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #dee2e6;">
<h4>đ HTMX Tutorial Post</h4>
<p>HTMX āĻĻāĻŋāϝāĻŧā§ āĻāĻŋāĻāĻžāĻŦā§ modern web application āϤā§āϰāĻŋ āĻāϰāĻŦā§āύ āϤāĻžāϰ āϏāĻŽā§āĻĒā§āϰā§āĻŖ āĻāĻžāĻāĻĄāĨ¤</p>
<div style="margin-top: 15px; display: flex; align-items: center; gap: 15px;">
<button hx-patch="toggle-like.html"
hx-target="#like-section"
hx-indicator="#like-loading"
style="background: #e3f2fd; color: #1976d2; padding: 8px 16px; border: 1px solid #1976d2; border-radius: 20px;">
đ āĻĒāĻāύā§āĻĻ āĻāϰā§āύ
</button>
<div id="like-section">
<span style="color: #6c757d;">⧍ā§Ģ āĻāύ āĻĒāĻāύā§āĻĻ āĻāϰā§āĻā§āύ</span>
</div>
<div id="like-loading" style="display: none; font-size: 12px; color: #6c757d;">
đ āĻāĻĒāĻĄā§āĻ āĻšāĻā§āĻā§...
</div>
</div>
</div>
đ toggle-like.html:
<span style="color: #1976d2; font-weight: bold;">
đ āĻāĻĒāύāĻŋ āĻāĻŦāĻ āĻāϰāĻ ā§¨ā§Ģ āĻāύ āĻĒāĻāύā§āĻĻ āĻāϰā§āĻā§āύ
</span>
đš Example 3: Priority Update
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #dee2e6;">
<h4>đ Task: HTMX Documentation āϞā§āĻāĻž</h4>
<p>āϏāĻŽā§āĻĒā§āϰā§āĻŖ HTMX tutorial series āϤā§āϰāĻŋ āĻāϰāĻž</p>
<div style="margin-top: 15px;">
<span>āĻ
āĻā§āϰāĻžāϧāĻŋāĻāĻžāϰ: </span>
<div id="priority-section" style="display: inline-block;">
<span style="background: #ffc107; color: #212529; padding: 4px 8px; border-radius: 4px; font-size: 12px;">
â ī¸ āĻŽāϧā§āϝāĻŽ
</span>
</div>
<div style="margin-top: 10px;">
<button hx-patch="set-priority-high.html"
hx-target="#priority-section"
hx-indicator="#priority-loading"
style="background: #dc3545; color: white; padding: 4px 8px; border: none; border-radius: 4px; font-size: 12px; margin-right: 5px;">
đ´ āĻāĻā§āĻ
</button>
<button hx-patch="set-priority-medium.html"
hx-target="#priority-section"
hx-indicator="#priority-loading"
style="background: #ffc107; color: #212529; padding: 4px 8px; border: none; border-radius: 4px; font-size: 12px; margin-right: 5px;">
đĄ āĻŽāϧā§āϝāĻŽ
</button>
<button hx-patch="set-priority-low.html"
hx-target="#priority-section"
hx-indicator="#priority-loading"
style="background: #28a745; color: white; padding: 4px 8px; border: none; border-radius: 4px; font-size: 12px;">
đĸ āύāĻŋāĻŽā§āύ
</button>
</div>
<div id="priority-loading" style="display: none; margin-top: 5px; font-size: 12px; color: #6c757d;">
đ āĻ
āĻā§āϰāĻžāϧāĻŋāĻāĻžāϰ āĻāĻĒāĻĄā§āĻ āĻšāĻā§āĻā§...
</div>
</div>
</div>
đ¯ āĻā§āύ Method āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ?
đ Decision Tree – āĻā§āύ Method āĻŦā§āĻā§ āύā§āĻŦā§āύ:
đ¤ āĻāĻĒāύāĻŋ āĻāĻŋ āĻāϰāϤ⧠āĻāĻžāύ?
đĨ āĻĄā§āĻāĻž āĻāύāϤ⧠āĻāĻžāύ?
â āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ: hx-get
- Page content load āĻāϰāĻž
- Search results āĻĻā§āĻāĻžāύā§
- User profile information
- Product details
đ¤ āύāϤā§āύ āĻĄā§āĻāĻž āϤā§āϰāĻŋ āĻāϰāϤ⧠āĻāĻžāύ?
â āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ: hx-post
- āύāϤā§āύ user registration
- Comment/review submit
- Form submission
- File upload
đ āϏāĻŽā§āĻĒā§āϰā§āĻŖ āĻĄā§āĻāĻž replace āĻāϰāϤ⧠āĻāĻžāύ?
â āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ: hx-put
- Complete profile update
- Product information change
- Settings configuration
- Full record replacement
đī¸ āĻĄā§āĻāĻž āĻŽā§āĻā§ āĻĢā§āϞāϤ⧠āĻāĻžāύ?
â āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ: hx-delete
- Account deletion
- Post/Comment removal
- File deletion
- Cart item removal
đ§ āĻļā§āϧ⧠āĻāĻŋāĻā§ field āĻāĻĒāĻĄā§āĻ āĻāϰāϤ⧠āĻāĻžāύ?
â āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ: hx-patch
- Status toggle
- Like/Unlike
- Priority change
- Single field update
đ Real-world Use Cases:
đĒ E-commerce Website:
- GET: Product list, product details, user profile āĻĻā§āĻāĻžāύā§
- POST: āύāϤā§āύ order create, user registration, review submit
- PUT: Complete profile update, product information change
- DELETE: Cart item remove, account delete, review delete
- PATCH: Wishlist toggle, quantity update, status change
đą Social Media App:
- GET: News feed, user posts, notifications load
- POST: āύāϤā§āύ post create, comment submit, message send
- PUT: Complete profile update, post edit
- DELETE: Post delete, comment remove, friend remove
- PATCH: Like/unlike, follow/unfollow, status update
đ Task Management:
- GET: Task list, project details, team members
- POST: āύāϤā§āύ task create, project create, team invite
- PUT: Complete task update, project settings
- DELETE: Task delete, project remove, member remove
- PATCH: Task status change, priority update, progress update
đī¸ RESTful API Concepts
đ¤ REST āĻāĻŋ?
REST (Representational State Transfer) āĻšāϞ web services design āĻāϰāĻžāϰ āĻāĻāĻāĻŋ architectural styleāĨ¤ āĻāĻāĻŋ HTTP methods āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠resources āĻāϰ āϏāĻžāĻĨā§ interact āĻāϰāĻžāϰ standard way āĻĒā§āϰāĻĻāĻžāύ āĻāϰā§āĨ¤
đ¯ RESTful API āĻāϰ āĻŽā§āϞ āύā§āϤāĻŋāĻŽāĻžāϞāĻž:
- Stateless: āĻĒā§āϰāϤāĻŋāĻāĻŋ request independent
- Resource-based: āϏāĻŦāĻāĻŋāĻā§ resource āĻšāĻŋāϏā§āĻŦā§ treat āĻāϰāĻž
- HTTP Methods: Standard HTTP verbs āĻŦā§āϝāĻŦāĻšāĻžāϰ
- Uniform Interface: Consistent API design
đ RESTful URL Structure Examples:
| HTTP Method | URL | āĻāĻžāĻ | HTMX Example |
|---|---|---|---|
| GET | /users | āϏāĻŦ users āĻāϰ list | hx-get="/users" |
| GET | /users/123 | Specific user details | hx-get="/users/123" |
| POST | /users | āύāϤā§āύ user āϤā§āϰāĻŋ | hx-post="/users" |
| PUT | /users/123 | User 123 āϏāĻŽā§āĻĒā§āϰā§āĻŖ update | hx-put="/users/123" |
| PATCH | /users/123 | User 123 āĻāĻāĻļāĻŋāĻ update | hx-patch="/users/123" |
| DELETE | /users/123 | User 123 delete | hx-delete="/users/123" |
đ Request/Response Handling
đĄ HTMX Request/Response Cycle:
1ī¸âŖ Request Phase:
- User interaction (click, submit, keyup etc.)
- HTMX triggers HTTP request
- Request headers āĻāĻŦāĻ data āĻĒāĻžāĻ āĻžāύā§
- Loading indicator āĻĻā§āĻāĻžāύ⧠(āϝāĻĻāĻŋ āĻĨāĻžāĻā§)
2ī¸âŖ Server Processing:
- Server request receive āĻāϰā§
- Business logic execute āĻāϰā§
- Database operations (āϝāĻĻāĻŋ āĻĒā§āϰāϝāĻŧā§āĻāύ)
- HTML response āϤā§āϰāĻŋ āĻāϰā§
3ī¸âŖ Response Phase:
- Server HTML response āĻĒāĻžāĻ āĻžāϝāĻŧ
- HTMX response receive āĻāϰā§
- Target element āĻ content update āĻāϰā§
- Loading indicator hide āĻāϰā§
đ§ Advanced Request Handling:
đ¤ Request Headers:
<!-- Custom headers āĻĒāĻžāĻ āĻžāύ⧠-->
<button hx-post="/api/users"
hx-headers='{"X-API-Key": "your-api-key", "Content-Type": "application/json"}'
hx-target="#result">
Submit with Headers
</button>
đĨ Response Handling:
<!-- Different response status handling -->
<form hx-post="/submit-form"
hx-target="#form-result"
hx-target-error="#error-message">
<!-- Form fields -->
</form>
<div id="form-result"></div>
<div id="error-message" style="color: red; display: none;"></div>
đ Request Validation:
<!-- Form validation with HTMX -->
<input type="email"
name="email"
hx-post="/validate-email"
hx-target="#email-validation"
hx-trigger="blur"
placeholder="āĻāĻŽā§āĻāϞ āĻ āĻŋāĻāĻžāύāĻž">
<div id="email-validation"></div>
â āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ⧍ āϏāĻžāϰāϏāĻāĻā§āώā§āĻĒ
đ āĻ āĻāĻŋāύāύā§āĻĻāύ! āĻāĻĒāύāĻŋ HTTP Methods āĻāϰ āϏāĻŽā§āĻĒā§āϰā§āĻŖ āĻŦāĻŋāώāϝāĻŧ āĻļāĻŋāĻā§āĻā§āύ!
đ āĻāĻ āϝāĻž āĻļāĻŋāĻāϞā§āύ:
- â hx-get: āĻĄā§āĻāĻž āĻāύāĻžāϰ āĻāύā§āϝ – āύāĻŋāϰāĻžāĻĒāĻĻ āĻāĻŦāĻ cacheable
- â hx-post: āύāϤā§āύ āĻĄā§āĻāĻž āϤā§āϰāĻŋāϰ āĻāύā§āϝ – form submission āĻāϰ āĻāύā§āϝ ideal
- â hx-put: āϏāĻŽā§āĻĒā§āϰā§āĻŖ āĻĄā§āĻāĻž replace āĻāϰāĻžāϰ āĻāύā§āϝ – complete updates
- â hx-delete: āĻĄā§āĻāĻž āĻŽā§āĻā§ āĻĢā§āϞāĻžāϰ āĻāύā§āϝ – āϏāĻžāĻŦāϧāĻžāύ⧠āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ
- â hx-patch: āĻāĻāĻļāĻŋāĻ āĻāĻĒāĻĄā§āĻā§āϰ āĻāύā§āϝ – efficient partial updates
- â RESTful API concepts āĻāĻŦāĻ best practices
- â Request/Response handling āĻāϰ āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ
đ¯ āĻŽā§āϞ āĻŦāĻŋāώāϝāĻŧāĻā§āϞā§:
- đš āĻĒā§āϰāϤāĻŋāĻāĻŋ HTTP Method āĻāϰ āĻāϞāĻžāĻĻāĻž āĻāĻĻā§āĻĻā§āĻļā§āϝ āĻāĻŦāĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ
- đš āĻā§āύ Method āĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŦā§āύ āϤāĻžāϰ decision tree
- đš Real-world examples āĻāĻŦāĻ practical implementations
- đš Security considerations āĻāĻŦāĻ best practices
- đš RESTful API design principles
đĄ āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ āĻāĻŋāĻĒāϏ:
- đ¸ GET: āϏāĻŦāϏāĻŽāϝāĻŧ safe operations āĻāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ
- đ¸ POST: āύāϤā§āύ resource āϤā§āϰāĻŋāϰ āĻāύā§āϝ ideal
- đ¸ PUT vs PATCH: Complete vs Partial update āĻāϰ āĻĒāĻžāϰā§āĻĨāĻā§āϝ āĻŦā§āĻā§āύ
- đ¸ DELETE: āϏāĻŦāϏāĻŽāϝāĻŧ confirmation āύāĻŋāύ
- đ¸ RESTful URLs: Consistent naming convention follow āĻāϰā§āύ
đ āĻĒāϰāĻŦāϰā§āϤ⧠āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞā§:
đ āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ā§Š: HTMX Attributes āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ
- đ¯
hx-targetāĻāϰ advanced usage - âĄ
hx-triggerāĻāϰ āϏāĻŦ options - đ
hx-swapāĻāϰ āĻŦāĻŋāĻāĻŋāύā§āύ modes - đĄ
hx-indicatorāĻāĻŦāĻ loading states - đ§
hx-headersāĻāĻŦāĻ custom headers - â
hx-confirmāĻāĻŦāĻ user confirmations
đ āĻĒā§āϰāϏā§āϤā§āϤāĻŋ: āĻāĻ āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞā§āϰ āϏāĻŦ examples practice āĻāϰā§āύ āĻāĻŦāĻ āύāĻŋāĻā§āϰ āĻŽāϤ⧠āĻāϰ⧠modify āĻāϰ⧠āĻĻā§āĻā§āύ!
đââī¸ Practice Exercises:
- Contact Form: āĻāĻāĻāĻŋ complete contact form āϤā§āϰāĻŋ āĻāϰā§āύ āϏāĻŦ HTTP methods āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§
- User Management: User list, create, update, delete functionality implement āĻāϰā§āύ
- Shopping Cart: Add to cart, update quantity, remove items functionality āϤā§āϰāĻŋ āĻāϰā§āύ
- Like System: Post like/unlike functionality implement āĻāϰā§āύ
- Status Toggle: User active/inactive status toggle āĻāϰāĻžāϰ system āϤā§āϰāĻŋ āĻāϰā§āύ
đ āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ ⧍ āϏāĻŽā§āĻĒāύā§āύ!
āĻāĻĒāύāĻŋ āĻāĻāύ HTMX āĻāϰ āϏāĻŦ HTTP Methods expert! đ
āĻĒāϰāĻŦāϰā§āϤ⧠āĻāĻŋāĻāĻā§āϰāĻŋāϝāĻŧāĻžāϞ⧠āĻĻā§āĻāĻž āĻšāĻŦā§! đ