PDA

Click to See Complete Forum and Search --> : jquery anyone?



mrkvavle
04-03-2007, 11:25 AM
instead of writing ajax from scratch im attempting to use the jquery library. anyone have any experience with it?

aversion
04-03-2007, 03:51 PM
I use the jquery library for projects all the time. I used to use the Prototype JS library but the lack of support and documentation really put me off. JQuery has a great and active community.

The AJAX functions are pretty simple to use, here's a quick example I did that sends a user's email address to the server, checks that the email belongs to a registered user, then sends back and ok or an error.



$.ajax({
type: "POST",
url: "../modules/checkmail.php",
data: "e=" + emlSt,
success: function(msg){
if(msg == "error"){
// show error message
} else {
// show success message
}
}
})

I show a tick mark or a cross next to the email input to show its validity in context and the user doesn't have to submit the form to find out.

There are different 'flavours' that can handle more complex transactions, handling timeouts etc, but this is the quick and easy way to do something simple in the background.