Log In

  Sign In >
 
 

Other tips & tutorials Blogs

Comparing PHP to ASP - Week 4 - Looping

2 Jun 2010
tips-tutorials

Looping is an important part of any development language. For this tutorial we will look at some ...

 
 

Comparing PHP to ASP - Week 3 - Number Functions

24 May 2010
tips-tutorials

Welcome to the third part of our 5 part tutorial where we will compare PHP with Classic ASP

 
 

Comparing PHP to ASP - Week 2 - String Functions

18 May 2010
tips-tutorials

Welcome to the second part of our 5 part tutorial where we will compare PHP with Classic ASP

 
 

Comparing PHP to ASP - Week 1 - The Basics

10 May 2010
tips-tutorials

Welcome to the first part of our 5 part tutorial where we will compare PHP with Classic ASP

 
 

Week 4 - Changing CSS attributes

19 Mar 2010
tips-tutorials

This week I will show you how to add CSS styles to elements on a page of your website.

 
 

Categories

Archive

2010
2 3 4 5 6 7 8 9 10 11 12

 

 

Week 5 - JQuery and AJAX

26 Mar 2010 - tips-tutorials

Week 5 - JQuery and AJAX

Welcome to the last part of our JQuery for beginners tutorials.

This week I will show you probably the main benefit of learning JQuery. AJAX (Asynchronous Javascript and XML) enables text data to be passed between pages without the page reloading, meaning a smoother user experience.

Using JQuery this is all very simple, just with a function like load(). There are several other functions like the $.get(), $.post() and $.ajax() functions which all allow AJAX to be used, but for this tutorial we will focus on the load() function.

For this tutorial I will load the contents of another page into a space on the current on the click of a button.

Here is an example of what we will produce

 


How to develop it

The page the content is loaded from is named tutorial5.txt and as you can see from the link all that is on the page is the text 'This is text from the page tutorial5.txt'.

That text is be loaded into a div on the current page with an ID of response when a input button is clicked. The button will have an ID of button.

Now for the JQuery that loads the content from tutorial 5 into the response div.

Breaking down the code

Assuming you are now a JQuery expert, I will only explain the line of code that is new to you.

Here quite simply the contents from http://www.candeomedia.com/tutorals/tutorial5.txt is loaded into the div with an ID (#) of response using the load function.

Pretty simple hey!! Using the older, non JQuery version of AJAX, this would have taken about 20 lines of code!

Finished code

I hope you have enjoyed our 5 tutorials on JQuery and has whetted your appitite to learn more.

I hope to do a 5 part tutorial on PHP for beginners in the future so look out for that.

Simon Lait
Website Developer, Candeo Media

SHARE THIS

Your Comments

There are no comments for this post yet.

Comment on this Post

 
 
 
verification image

Please enter the verification code that appears in the box above into the box below to proceed:

 
 
 
 
 
 
Web Design & Development, Graphic Design, Email Newsletter Marketing, Search Engine Optimisation, Web Application Development, Social Networking and more...
 
 
Close

Sign up to our newsletter