More about jQuery AJAX

Uncategorized. 8 comments

13th October

jQuery made AJAX simple by using .ajax() function.
The syntax for this function is:

$.ajax( /* properties */);

Now let me explain what properties we can use in this function.

First, I would like to tell you what basic (standard) options for .ajax() as follow:
– url: String /* The URL to send the request to */
– type: String /* The request type (“GET”, “POST”) */
– contentType: String /* default: “application/x-www-form-urlencoded” */
– data: Object, String /* Data to be sent to the server. It is converted to a query string, if not already a string. It’s appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key i.e. {foo:[“bar1”, “bar2”]} becomes ‘&foo=bar1&foo=bar2’ */

– beforeSend: Function /* This function runs just before sending the request */
– … Read More »

jQuery Animate – Advanced

24th September

In the last jQuery Animate article I wrote, I mentioned how to use the .animate() function with few tricks.

But here, I am going to write about jQuery Animate function in general and I will explain few things and some tricks.

The jQuery Animate is a smart object because could be used at any syntax.
I mean,
We can use the default syntax of this function as follow:

/* params */ },
/* integet time period in milliseconds */

jQuery: Catch Keyboard Events

18th June

Lot of jQuery projects relies on keyboard/mouse event like pressing “p” for previous and “n” for next also using the arrows.

Because this is important, I have managed a code to get the keyboard character on 3 events:
– Keypress
– Keyup
– Keydown

I have created a function to return the key as below:

function getKey(key){
if ( key == null ) {
keycode = event.keyCode; // To Mozilla
} else {
keycode = key.keyCode;
// Return the key in lower case form
return String.fromCharCode(keycode).toLowerCase();

Now let’s use the events:

$(document).keypress(function (eh){
alert(“Keypress: The key is: “+getKey(eh));

$(document).keyup(function (eh){
alert(“Keyup: The key is: “+getKey(eh));

$(document).keydown(function (eh){
alert(“Keydown: The key is: “+getKey(eh));

To see an exaple of this code, please check the … Read More »

jQuery Image Map

Uncategorized. 10 comments

3rd June

Hi reader,
Today i have experienced something new with images.
I created HTML page contains image. This image was mapped by using <MAP tag.

You can’t find these areas when are browsing this page.. Because these areas (dimensions) are hidden and have nothing to be identified.

So, I was looking for way to identify these areas with something till i had an idea of adding borders or creating a floating DIV with 0.3 opacity to tell the visitor that you are pointing to this area.

jQuery Animate

19th May

Here I will mention how to use the jquery animate function and the usability and flexibility of it.
The syntax of this function is:

$.animate(options, settings, callback);
/* you can replace setting with duration (in milliseconds) or words: ‘slow’, ‘normal’ or ‘fast’.
callback is optional */

Below is a list of popular and most used animation:

increasing/decreasing width and height
moving or scrolling html element
changing opacity
scrolling window

Now let me explain each in an example.

Top 5 jQuery image galleries

3rd May

This article is old. Please view 10 top jQuery plugins for images in 2011

I have collected some jQuery image galleries for you to choose your preferred one. Each one is working in different way than the other.
Here is the list of the top 5 jquery image galleries: