Tuesday, June 10, 2008

jQuery AJAX Login

Wanted to use jQuery to display a login form on a site, and use AJAX to do the login. Seemed easy enough. Prerequisites are jQuery, and jqModal. Created an HTML page with a Login link, and a jqModal div that hides the username, password form.


<a class="display-form">Login</a>

<div id="login" class="jqmDialog">
<div class="jqmdMSG">
<form id="login-form"> here is the login form.
hidden in a jqModal div. The css hides the div.
The jQuery javascript handles the show/hide of the
login form.</form>
</div>
</div>

<script src="text/javascript" >
$().ready( function() {
// setup the login form to display,
// hide itself appropriately.
var t = $('#login div.jqmdMSG');
$('#login').jqm({
// a link of class display-form is clicked,
// the login dialog will be displayed
trigger:'a.display-form',
target: t,
overlay: 30,
onHide: function(h) {
h.o.remove(); // remove the overlay
h.w.fadeOut(888); // fade out the dialog
}
});

// setup the login form to work via ajax
$('#login-form').ajaxForm({
url: 'url to post form to',
beforeSubmit: function(formData, jqForm, options) {
// code executed before form
// is submited could possibly
// display a "Please wait ..."
// and hide the login button on the form
return true;
},
success: function(responseText, statusText) {
// code executed if logged in success
},
error: function(responseText, statusText) {
// code executed if things failed
}
});
});
</script>

Monday, June 02, 2008

WebFaction Web Hosting that Doesn't Suck

Have to say I have been quite pleased with my web hosting through WebFaction. When looking for a Web Hosting Provider such as WebFaction, these things are most important to me:

  1. Uptime, the server needs to be up all the time
  2. Fast, even under heaving loads the server needs to respond quickly to user requests
  3. Support, when I contact them at anytime day or night, I expect a response within a few hours
  4. Ease of Use, configuring websites should be easy

I've found that WebFaction meets my web hosting requirements.

I've gone with other hosting providers and have never been that impressed. Other web hosting providers tend to never have competent staff on duty. Don't care about uptime. Give an ancient software interface to configure things. And whats really annoying is when there web hosting is down, they could care less about getting things back up again fast. Drives me crazy, if my site isn't up, there is no money being made. If there is no money being made, then I don't have money for food. If I don't have money for food ... well lets just say I can be a little cranky.

So my hats off to WebFaction. They deliver good service, for a decent price, with good support.