background preloader

5 Ways to Make Ajax Calls with jQuery

5 Ways to Make Ajax Calls with jQuery
There are at least five ways to make AJAX calls with the jQuery library. For beginners, however, the differences between each can be a bit confusing. In this tutorial, we'll line them up and make a comparison. This section is for those who have no idea what AJAX is. In Gmail, switch from inbox to draft. The key to AJAX's concept is "asynchronous". Now we should know what AJAX actually is. For static content, we may want the response cached. The most common use of AJAX is for loading HTML from a remote location and injecting it into the DOM. Click on the first button named "load()." Below is the JavaScript code for this effect: $.ajaxSetup forces the browser NOT to cache AJAX calls.After the button is clicked, it takes a little while before the new HTML is loaded. Now, let's explore more details of the request with Firebug: Open Firebug.Switch to the "Net" tab. The request is displayed, right? Click on the "Params" tab. Click on the "Response" tab. Click on "load() #DOM" button.

Echo Test Echo Test The first section of this page will let you do an HTML5 WebSocket test against the echo server. The second section walks you through creating a WebSocket application yourself. You can also inspect WebSocket messages using your browser. Try it out! This browser supports WebSocket. Does your browsersupport WebSocket? Firefox 17 Linux Uh-oh, the browser you're using doesn't have native support for WebSocket. The following link lists the browsers that support WebSocket: Location:Use secure WebSocket (TLS) Message: Instructions Press the Connect button. Creating your own test Using a text editor, copy the following code and save it as websocket.html somewhere on your hard drive. Pricing Urban Airship’s platform is built for business—we help the world’s largest and most mobile-savvy brands connect to customers at any scale and with a full-featured platform that includes push notifications and in-app messaging. Communicate with millions of users with confidence to engage users, convert buyers, and build loyalty. Our platform also supports the most sophisticated use cases through optional add-ons such as location-based messaging and location history. Our platform includes: Contact Sales

Quotes and expressions. The most inspiring expressions of mankind. This information will be helpful for developers who want to use the feature set of forismatic website in their own software products. API method calls are implemented in the form of HTTP requests to the URL Query parameters are passed using POST or GET (URL-encoded) method. The server return data format is set by the query parameter. Selects a random quote using passed numeric key, if the key is not specified the server generates a random key. POST: method=getQuote&key=457653&format=xml&lang=en response: <forismatic> <quote> <quoteText>Brevity — the soul of wit</quoteText> <quoteAuthor></quoteAuthor> <senderName>name or nickname of the quote sender</senderName> <senderLink>email or website address of the quote sender</senderLink> </quote> </forismatic>

8 Code Snippets for New Website Projects Working as a web developer often requires compromise and trying out new systems. Some of your code will turn out to be a flunk, and other codes will become staples in your development process. I have learned a lot about useful code snippets and how greatly these can affect your development process. In this article I’d like to share 8 bits of code which any web developer can use. These code blocks include typical HTML5 and some more intermediate-level CSS3 solutions for various website layouts. 1. To get us started I have included my very basic HTML5 webpage template. Also I have included references to 2 Google-hosted scripts. <! 2. I learned about the CSS clearfix method years ago when just first getting into coding. You should copy my code below into any CSS document you’re using with floats in a layout. 3. Each web browser comes packaged with its own set of standard rules for styling documents. 4. 5. 6. 7. 8. Thankfully the audio and video tags share a similar syntax. Conclusion

Php Object Generator (3.0f) - Open Source PHP Code Generator PHP Object Generator, (POG) is an open source which automatically generates clean & tested Object Oriented code for your PHP4/PHP5 application. Over the years, we realized that a large portion of a PHP programmer's time is wasted on repetitive coding of the Database Access Layer of an application simply because different applications require different objects. By generating PHP objects with integrated CRUD methods, POG gives you a head start in any project. Fast and scalable Generates clean+tested code Generates CRUD methods Generates setup file Generates parent-child relations Generates sibling relations Extensible via plugins Compatible with PHP4 & PHP5 Compatible with PDO Automatic data encoding Free Developer SOAP API Free for personal use Free for commercial use Open Source

Mobile In Minutes With Sinatra Sinatra is described as a DSL for quickly creating web applications in Ruby with minimal effort. Sinatra makes it extremely easy to host a web application and expose RESTful services. Here we’ll show how this allows you to get mobile applications up and running in minutes with Sinatra. Quick Introduction to Sinatra The following ruby file is a valid RESTful service with Sinatra: 01.require 'sinatra' 02.require 'json/pure' 04.get '/hello/:name.json' do 05. content_type :json 08. }.to_json 09.end Here we are telling Sinatra to respond to any GET requests to the URI pattern /hello/.json. To run this example, save the above code snippet to file named hello.rb. 1.$ gem install json_pure 2.$ gem install sinatra 3.ruby -rubygems hello.rb Now navigate to the URL (feel free to use your own name) and you will be presented with: Now we can easily consume that service with a jQuery script and host the script with Sinatra: 01. 02. 03. 04. 06. alert(data.message); 08. 09. 10. 11. 12. 08.

learn.knockoutjs.com In this first tutorial you'll experience some of the basics of building a web UI with the Model-View-ViewModel (MVVM) pattern using knockout.js. You'll learn how to define a UI's appearance using views and declarative bindings, its data and behavior using viewmodels and observables, and how everything stays in sync automatically thanks to Knockout's dependency tracking (even with arbitrary cascading chains of data). Using bindings in the view In the bottom-right corner, you've got a viewmodel containing data about a person. In the top-right corner, you've got a view that's supposed to display the person data. Modify the two <strong> elements in the view, adding data-bind attributes to display the person's name: <p>First name: <strong data-bind="text: firstName"></strong></p><p>Last name: <strong data-bind="text: lastName"></strong></p> data-bind attributes are how Knockout lets you declaratively associate viewmodel properties with DOM elements. Running the code Having trouble?

Federico Cargnelutti Event Delegation One of the hot methodologies in the JavaScript world is event delegation, and for good reason. Event delegation allows you to avoid adding event listeners to specific nodes; instead, the event listener is added to one parent. That event listener analyzes bubbled events to find a match on child elements. The base concept is fairly simple but many people don't understand just how event delegation works. Let me explain the how event delegation works and provide pure JavaScript example of basic event delegation. Let's say that we have a parent UL element with several child elements: <ul id="parent-list"><li id="post-1">Item 1</li><li id="post-2">Item 2</li><li id="post-3">Item 3</li><li id="post-4">Item 4</li><li id="post-5">Item 5</li><li id="post-6">Item 6</li></ul> Let's also say that something needs to happen when each child element is clicked. Simple: when the event bubbles up to the UL element, you check the event object's target property to gain a reference to the actual clicked node.

JavaScript -> TinySlideshow This file has been reported as broken because: thank you Rate File: 1 Votes (You voted 5) File Name TinySlideshow by Michael Submitted 17 November 2009 - 09:09 PM Last Updated File Type (zip - application/zip) Screenshot Not Available File Size 654.26K (Estimated Download Times) Views Downloads View member's files File Description This Javascript slideshow is feature packed and under 5KB. Estimated Download Times Dialup (56Kbps) 1 minutes 34 seconds DSL (768Kbps) 7 seconds T1 (1.5Mbps) 4 seconds Cable (3Mbps) 2 seconds Fios (10Mbps) 1 seconds Random Files Files Uploaded Today Download Statistics Total Files Total Categories Total Authors Total Downloads Latest File The latest file submitted was TinyDropdown 2 by Michael

Flot: Attractive JavaScript plotting for jQuery I Did It My Way Ajax has been around for a while now but that doesn’t mean it is any less fun. The nice thing about Sinatra is you are left to do as much or little JavaScript as you like and you can do it in any way that you want as well. In this ditty I hope to show that it’s easy to add some Ajax magic to a Sinatra app (with a little help from a JavaScript framework). Set Up the App First of all we will build a very simple app. Tell us the date and time Show a message from the server Reverse some text (just like in our first app To start with we will require the necessary gems: %w[rubygems sinatra haml].each{ |gem| require gem } Note the neat way of doing this as a one-liner - you can just add as many gems as you want to the array as you require more gems. Next up are the handlers: All one liners again. Last of all we need some views. __END__ @@layout !!! These views use haml, but should be fairly straighforward. Enter Ajax I’m going to use the RightJS JavaScript library for the Ajax functionality.

Related: