Ichigo, an ASP.NET Blogging Engine

With this post, I intend to leave a trace of the specs of this blog. I started this project in 2008 and never publicly mentioned it. Codename is Ichigo, named after Kurosaki Ichigo, the main character of the manga series Bleach by Tite Kubo. There’s no particular reason for the reference—I just like the manga. Since then, the blog has been a playground to experiment with technologies, including Entity Framework, Dynamic Data, URL Routing, ASP.NET AJAX, jQuery, @font-face, and OAuth. ...

November 12, 2013 · 2 min · Andrea Azzola

Turn Sentences into Slugs with JavaScript

This simple script converts a text string into a valid URL slug. It mixes jQuery with standard JavaScript, and can be easily adapted to pure JS. <!-- Example input element --> <input id="controlId" type="text" /> // Handles typing $(document).ready(function () { // If the Title is specified, avoid overwrite if ($('#controlId').val().length === 0) { $('#controlId').on('keypress', function () { $('#controlId').val(slugify($('#controlId').val().toLowerCase())); }); } }); // Replacements function slugify(text) { text = text.replace(/[^-a-zA-Z0-9,&\s]+/g, ''); text = text.replace(/-/g, '_'); text = text.replace(/\s/g, '-'); return text; } Note (2025): For modern projects you may also want to normalize accents (é → e), trim repeated separators, and prefer input event instead of keypress. This post keeps the original 2010 logic. ...

October 20, 2010 · 1 min · Andrea Azzola

POST data with JavaScript

Note (2025): This article dates back to 2009. The examples remain useful, though modern apps often prefer fetch()/XHR or form submissions driven by frameworks. The classic form‑build approach below still works universally. HTML 4.0 (W3C) defines how browsers submit forms: GET: append query string to the action URL (application/x-www-form-urlencoded). POST: send a request body to the action URL, using the content type indicated by enctype. Programmatic POST helper Add this in your page head: ...

July 7, 2009 · 1 min · Andrea Azzola

Submit di un Form tramite POST JavaScript

Secondo le specifiche HTML 4.0{:target="_blank" rel=“noopener”}: Se il metodo è GET, lo user agent prende il valore dell’azione, vi concatena un ? e il data set del form, mediante il content-type application/x-www-form-urlencoded. In questo caso i dati del form sono vincolati a codici ASCII. Se il metodo è POST, lo user agent effettua un submit HTTP POST utilizzando il valore dell’action e un messaggio creato in accordo con il content type specificato nell’attributo enctype. Vantaggi dei POST JavaScript Effettuare redirect diversi all’action Veicolare dati senza refresh della UI Evitare query string troppo lunghe e URL poco leggibili Esempio di submit POST Inserire il seguente codice nella sezione <head> della pagina HTML: ...

July 7, 2009 · 2 min · Andrea Azzola