JavaScript Date Ago
Posted by Chris | Filed under JavaScript
In case you hadn’t noticed, one of the hip things to do with user-visible timestamps these days is to format them as a how long ago the time was. Instead of seeing a date and time like “08/02/2009 2:41 PM PST,” these so-called passed/relative/pretty/friendly dates appear like “2 hours ago” or “1 week ago.”
Being a [...]
Tags: ago, date, JavaScript
Fade background color in JavaScript
Posted by Chris | Filed under JavaScript
Background
A project I’ve been working on recently is a light-weight AJAX messageboard that looks a lot like Reddit’s or Hacker News’ comments pages. The spiffy part though is that there’s no refresh needed to see new replies since the page has loaded—new posts aysnchronously appear in the thread as users post them.
To make it obvious [...]
Tags: JavaScript
JavaScript Query String
Posted by Chris | Filed under JavaScript
Query Strings
When I started coding more client-side JavaScript in replace of ASP.NET code, I was surprised to find there there’s no object in JavaScript that breaks down a query string into a key (or name)/value collection, as this.Request.QueryString does in ASP.NET.
Here’s a URL with a query string:
http://prettycode.com/search?query=code&pageSize=20
The query string is everything that including and [...]
Tags: ASP.NET, JavaScript, query string, querystring
Simplify jQuery with ASP.NET Web Services and JSON
Posted by Chris | Filed under ASP.NET, Ajax, jQuery
Introduction
In my last post, I gave a quick introduction to using jQuery for JSON communication with ASP.NET web and WCF services. It’s not very complicated, but it’s distinct enough from consuming XML or other services to warrant a little explaining.
In this post, I’m going to suggest you save yourself of writing out or copying/pasting that [...]
Tags: Ajax, ASP.NET, ASP.NET AJAX, JavaScript, jQuery, JSON, JSON dates, parse JSON dates, web services
Using jQuery with ASP.NET Web Services and JSON
Posted by Chris | Filed under ASP.NET, Ajax, jQuery
By now, hopefully everyone’s played with jQuery for client-side JavaScript work and knows it eliminates the fuss of manually writing Ajax code. In this post, I’ll briefly cover the idiosyncrasies of using jQuery Ajax to consume .NET 3.5 web services that serve JSON. Although I mostly show examples of ASPX pages with WebMethods, all the [...]
Tags: Ajax, ASP.NET, ASP.NET AJAX, JavaScript, jQuery, JSON, JSON dates, parse JSON dates, web services