CarmaBlog

Agility, Java programming, New technologies and more…
  • rss
  • Home
  • Management
  • Agile Programming
  • Technology
  • Linux
  • Event
  • Contact
  • About the author
  • English
  • Francais

jQuery & Ajax

Fabian Piau | Thursday September 22nd, 2011 - 06:05 PM
929 views
  • Twitter
  • Facebook
  • Google +1
  • LinkedIn

Ajax

Ajax logo

Appeared in 2005, Ajax (Asynchronous JavaScript and XML) is a group of existing technologies, including HTML, JavaScript and XML. With Ajax, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. Thus, it allows Web pages to be more interactive and behave like local applications, which are also known as RIA applications (Rich Internet Applications). The term “Asynchronous” means that the JavaScript allows the page to continue to be processed and will handle the reply if and when it arrives. In synchronous mode, the browser is “frozen” while the request is processing.


jQuery

jQuery logo

Initiated in 2006, the jQuery project is an open source JavaScript library which has become very popular. It allows the development of JavaScript quickly and concisely, as its slogan “Write less, do more” says ! jQuery handles events, performs animations, includes CSS selectors, adds Ajax interactions to Web pages… In addition, many plugins are available and the library is cross-browser.


Ajax with jQuery

There are several ways to do Ajax with jQuery.


$.get(url, data, callback, type)

$.get() is a general way to make GET requests. It handles the response of many formats including XML, Html, Text, Script and Json.

	function add_elements_table(elementIds) {
		$.get( 'demoajax.php', 
				{	
					'cmd': 'addElements', 
					'elementSelecteds': elementIds
				}, 
				function (data) { refresh_table() });
	}



$.post(url, data, callback, type)

$.post() does exactly the same job as $.get(), except for the fact that it makes a POST request instead.


$.ajax(settings)

$.get() and $.post() are high-level abstractions that are often easy to understand and use. If you need maximum control over your requests, check out the $.ajax() function. You can specify ajax options (e.g. error callbacks, browser cache). $.ajax() argument is a set of key/value pairs that initialize and configure the Ajax request.

	function add_elements_table(elementIds) {
		$.ajax({ url : 'demoajax.php', 
				data : {	
					'cmd': 'addElements', 
					'elementSelecteds': elementIds
				},
				cache : false,
				success : function (data) { refresh_table() }});
	}


Ajax caching issues with Internet Explorer !

I have been working on a project that involves using jQuery and Ajax. I have using the $.get() method to handle simple calls. The JavaScript was working great on Firefox, Chrome and also on Internet Explorer 6.
However, I realized that on IE7, 8 and 9, some strange and random behaviors happen.
After some research, I find out that it was a caching issue. The first time, the Ajax call is properly treated. But, the second time, the server has not been requested and the data from the very first Ajax call was returned…
Now, I recommend the use of $.ajax() with the “cache: false” option.

Related posts

Progress barDate progress bar using JQuery
Comments
No Comments »
Categories
Agile programming
Tags
ajax, jquery, caching issue ie
Comments rss Comments rss
Page 1 of 11

Language

  • Français
  • English

Most viewed posts

  • Changing the language in Firefox - 18,864 views
  • Java EE & CDI vs. Spring - 10,084 views
  • Customizing Gnome 3 (Shell) - 8,206 views
  • Firefox Nightly, Aurora, Beta, Desktop, Mobile, ESR & Co. - 6,002 views
  • WordPress plugins of CarmaBlog - 5,370 views
  • Open Street Map, better map than Google Maps? - 3,137 views
  • This file is currently used, you cannot do anything… Thanks you Windows ! - 2,911 views
  • Belbin – Team Role Theory - 2,392 views
  • Using Google Docs to create an online survey - 2,055 views
  • Changing the Eclipse splash screen in few seconds - 2,016 views

Tags

google wave ci documents search engine firefox windows seven hard drive tool unmount plugin windows 7 build training eject configuration management shortcut extension nosql nantes tdd java mongodb docjax cloud wordpress fosdem automation .net extreme programming unit test eclipse hibernate c# chrome mobile computing ubuntu jug agility continuous integration script test itil jquery bash watin sharing best practices agile ebook blog

Recent Posts

  • Get the opportunity to start a course about Gamification Tuesday April 2nd, 2013
  • Comparing NoSQL: Couchbase & MongoDB Friday March 8th, 2013
  • IconFinder, find efficiently your icons Friday March 1st, 2013
  • Fosdem 2013 Impressions Wednesday February 20th, 2013
  • Fosdem, a truly open conference Monday January 28th, 2013
  • Free online MongoDB training Tuesday January 1st, 2013
  • Discover Maxthon Tuesday December 11th, 2012
  • Shutdown, standby or hibernate your computer? Sunday December 9th, 2012
  • A mobile version of your WordPress Blog Sunday October 28th, 2012
  • Using Google Docs to create an online survey Monday September 24th, 2012
  • Open Street Map, better map than Google Maps? Wednesday July 25th, 2012
  • First steps with Apache Camel Friday May 11th, 2012
  • This file is currently used, you cannot do anything… Thanks you Windows ! Sunday April 22nd, 2012
  • Customizing Gnome 3 (Shell) Thursday March 15th, 2012
  • Give your application a facelift – CSS Wednesday February 15th, 2012

RSS feeds

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Email Subscription

Enter your email address to receive notifications of new posts.

Links

  • Agile Nantes
  • Blog Ippon Technologies
  • Blog Netapsys
  • Blog Xebia France
  • Blog Zenika
  • Coursera
  • Developpef
  • Le Touilleur Express
  • Les Cast Codeurs Podcast
  • new Blog( perso );
  • OCTO talks !
  • The Coder's Breakfast

Follow me!

Follow me on TwitterFollow me on LinkedInFollow me on Google+Follow me on About.meFollow me on SlideShare

Categories

  • Event (9)
  • Linux (3)
  • Management (4)
  • Agile programming (11)
  • Technology (26)

Archives

  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (1)
  • January 2013 (2)
  • December 2012 (2)
  • October 2012 (1)
  • September 2012 (1)
  • July 2012 (1)
  • May 2012 (1)
  • April 2012 (1)
  • March 2012 (1)
  • February 2012 (1)
  • January 2012 (2)
  • December 2011 (1)
  • November 2011 (2)
  • October 2011 (2)
  • September 2011 (1)
  • July 2011 (1)
  • June 2011 (2)
  • April 2011 (1)
  • March 2011 (1)
  • February 2011 (1)
  • January 2011 (2)
  • November 2010 (2)
  • September 2010 (1)
  • August 2010 (1)
  • July 2010 (1)
  • June 2010 (1)
  • May 2010 (1)
  • April 2010 (1)
  • March 2010 (1)
  • February 2010 (1)
  • December 2009 (1)
  • November 2009 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (3)
  • July 2009 (1)
  • June 2009 (2)
rss Comments rss get firefox
Fabian Piau | Copyright © 2009 - 2013
All Rights Reserved | Top ↑