- Creating a MySQL connection with PHP/AJAX
The
purpose of this article is to demonstrate how the XMLHttpRequest object
works within php and the advantages of using it. This tutorial will be
the first in a series of articles leading to the development of a fully
functional dynamic web events application. AJAX is a fancy technique
for creating websites that gather information from servers without
having to refresh themselves. I could get into the nitty-gritty about
advantages and disadvantages of using AJAX but for now all you need to
know is any users action that would normally generate a HTTP request
takes the form of a JavaScript call to the AJAX engine instead. The
engine makes any data requests asynchronously without pausing a user’s
interaction with the web application.
- Getting Started with Ajax
Ajax
stands for Asynchronous JavaScript and XML. In a nutshell, it is the
use of the nonstandard XMLHttpRequest() object to communicate with
server-side scripts. It can send as well as receive information in a
variety of formats, including XML, HTML, and even text files. Ajax’s
most appealing characteristic, however, is its “asynchronous” nature,
which means it can do all of this without having to refresh the page.
This allows you to update portions of a page based upon user events and
provides one of the cornerstones of Rich Internet Applications
(RIA) referred to in discussions of “Web 2.0.” The DOM plays into Ajax
in a number of ways. How you use the DOM depends a good deal on how you
handle the content returned from the server. You can treat the content
as simple text using the response Text property of the server response,
or you can treat it as XML using responseXML.
- Mastering
Ajax part-2
Most Web applications use a request/response model that gets an entire
HTML page from the server. The result is a back-and-forth that usually
involves clicking a button, waiting for the server, clicking another
button, and then waiting some more. With Ajax and the XMLHttpRequest
object, you can use a request/response model that never leaves users
waiting for a server to respond. In this article, Brett McLaughlin
shows you how to create XMLHttpRequest instances in a cross-browser
way, construct and send requests, and respond to the server. In the
last article of this series, you were introduced to the Ajax
applications and looked at some of the basic concepts that drive Ajax
applications. At the center of this was a lot of technology that you
probably already know about: JavaScript, HTML and XHTML, a bit of
dynamic HTML, and even some DOM. In this article, I will zoom in from
that 10,000-foot view and focus on specific Ajax details.
- Mastering
Ajax: Introduction to Ajax
Ajax, which consists of HTML, JavaScript™ technology, DHTML, and DOM,
is an outstanding approach that helps you transform clunky Web interfaces
into interactive Ajax applications. The author, an Ajax expert,
demonstrates how these technologies work together - from an overview to
a detailed look -- to make extremely efficient Web development an easy
reality. He also unveils the central concepts of Ajax, including the
XMLHttpRequest object. Five years ago, if you didn't know XML, you were
the ugly duckling whom nobody talked to. Eighteen months ago, Ruby came
into the limelight and programmers who didn't know what was going on
with Ruby weren't welcome at the water cooler. Today, if you want to
get into the latest technology rage, Ajax is where it's at. These are
both familiar; desktop applications usually come on a CD and install
completely on your computer. They might use the Internet to download
updates, but the code that runs these applications resides on your
desktop. Web applications -- and there's no surprise here -- run on a Web server somewhere and you access the application with your Web browser.
- Guide to Using AJAX and XMLHttpRequest from WebPasties
The XMLHttpRequest object is a handy dandy JavaScript object that
offers a convenient way for webpages to get information from servers
without refreshing themselves. The benefit to end users is that they
don't have to type as much and they don't have to wait as long. For
example, having the user's city and state show up in a webpage
automatically after the ZIP code has been typed in is a big time saver.
Although the XMLHttpRequest object might sound complex and different
from any other JavaScript object you have ever used, it really isn't. A
good way to think of the XMLHttpRequest object is as you would think of
the JavaScript Image object. As we know, with the Image object you can
dynamically specify a new URL for the image source without reloading
the page. Similarly with the XMLHttpRequest object, you can dynamically
specify a URL to get some server data without reloading the page.
- Direct Web Remoting
DWR allows JavaScript in a browser to interact with Java on a server
and helps you manipulate web pages with the results. Our stable release
is DWR version 1.1. We are developing DWR version 2.0, and recently
announced 'Reverse Ajax' which allows Java on the server to
asynchronously send JavaScript to the client. License" shall mean the
terms and conditions for use, reproduction, and distribution as defined
by Sections 1 through 9 of this document. Licensor" shall mean the
copyright owner or entity authorized by the copyright owner that is
granting the License. Legal Entity" shall mean the union of the acting
entity and all other entities that control, are controlled by, or are
under common control with that entity. For the purposes of this
definition, "control" means (i) the power, direct or indirect, to cause
the direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
- Sajax
Toolkit
Commercial
consulting and support now available. Get support from the people who
made Ajax easy for the masses. If your staff needs a helping hand with
your Ajax project, we now offer commercial support and consulting.
Email support for the Sajax library starts at an affordable $199 per
year. We can help you build your project for rates from $150 per hour.
Contact us for more information. Sajax itself remains under the open
source BSD license. Breaking news: After a long delay, Sajax version
0.12 is finally out. PHP support has been much improved, including many
bug fixes and improvements to the serialization support. Please
download the new version and contact us if you find any bugs. Sajax is
an open source tool to make programming websites using the Ajax
framework - also known as XMLHTTPRequest or remote scripting - as easy
as possible. Sajax makes it easy to call PHP, Perl or Python functions
from your webpages via JavaScript without performing a browser refresh.
The toolkit does 99% of the work for you so you have no excuse to not
use it.
- JavaScript
Rico Internet Application
Ajax is the term that describes a set of web development techniques for
creating interactive web applications. One of the key ingredients is
the JavaScript object XmlHttpRequest. Rico provides a very simple
interface for registering Ajax request handlers as well as HTML
elements or JavaScript objects as Ajax response objects. Multiple
elements and/or objects may be updated as the result of one Ajax
request. Desktop applications have long used drag and drop in their
interfaces to simplify user interaction. Rico provides one of the
simplest interfaces for enabling your web application to support drag
and drop. Just register any HTML element or JavaScript object as a drag
gable and any other HTML element or JavaScript object as a drop zone
and Rico handles the rest.
- How does xajax work?
The xajax PHP object generates JavaScript wrapper functions for the PHP
functions you want to be able to call asynchronously from your
application. When called, these wrapper functions use JavaScript's
XMLHttpRequest object to asynchronously communicate with the xajax
object on the server which calls the corresponding PHP functions. Upon
completion, an xajax XML response is returned from the PHP functions,
which xajax passes back to the application. The XML response contains
instructions and data that are parsed by xajax's JavaScript message
pump and used to update the content of your application. xajax's unique
XML response / JavaScript message-pump system does the work for you,
automatically handling the data returned from your functions and
updating your content or state according to the instructions you return
from your PHP functions. Because xajax does the work, you don't have to
write JavaScript callback handler functions.
- Welcome
to Ajax any where
AjaxAnywhere
is designed to turn any set of existing JSP or JSF components into
AJAX-aware components without complex JavaScript coding. In contrast to
other solutions AjaxAnywhere is not component-oriented. You will not
find here yet another AutoComplete component. Simply separate your web
page into multiple zones, and use AjaxAnywhere to refresh only those
zones that needs to be updated. Advantages * Less JavaScript to develop and to
maintain. Absence of commonly accepted naming convention, formatting
rules, patterns makes JavaScript code messier then Java/JSP. It is
extremely difficult to debug and unit-test it in multi-browser
environment. Get rid of all those complexities by using AjaxAnywhere.
* Easy to integrate. AjaxAnywhere does not require changing the underlying application code.
* Lower technical risk. Switch whenever you need between AJAX and
traditional behaviour of your web application. Your application can
also support both behaviors.
- How To Use AJAX
AJAX,
an acronym for Asynchronous JavaScript and XML, is the latest
technology buzzword. Asynchronous means that you can make a request to
a server via Hypertext Transfer Protocol (HTTP) and continue to process
other data while waiting for the response. This means, for example,
that you can make calls to a server-side script to retrieve data from a
database
as XML, send data to a server-side script to be stored in a database,
or simply load an XML file to populate pages of your Web site without
refreshing the page. However, along with all of the benefits, AJAX
sparks some unquestionable debate over issues with the Back button.
This article will help you to determine when AJAX is a good solution
for developing your users' experiences.
- Very Dynamic Web Interfaces
One
of the classic drawbacks to building a web application interface is
that once a page has been downloaded to the client, the connection to
the server is severed. Any attempt at a dynamic interface involves a
full roundtrip of the whole page back to the server for a rebuild--a
process which tends to make your web app feel inelegant and
unresponsive. In this article, I'll be exploring how this problem can
be tackled with the use of JavaScript and the XMLHttpRequest object.
The user requests a page from the server, which is built and delivered
to the browser. This page includes an HTML form element for capturing
data from the user. Once the user posts their input back to the server,
the next page can be built and served based on the input, and so the
process continues. This is largely dictated by the nature of HTTP and
differs from the traditional desktop application model of an interface
which is inherently connected to the application layer.
- AJAX: Getting
Started
AJAX (Asynchronous JavaScript and XML) is a newly coined term for two
powerful browser features that have been around for years, but were
overlooked by many web developers until recently when applications such
as Gmail, Google Suggest, and Google Maps hit the streets.
The two features in question are that you can:
* Make requests to the server without reloading the page
* Parse and work with XML documents
- Using the XML HTTP Request object
Internet Explorer on Windows, Safari on Mac OS-X, Mozilla on all
platforms, Konqueror in KDE, Ice Browser on Java, and Opera on all
platforms including Symbian provide a method for client side JavaScript
to make HTTP requests. From the humble begins as an oddly named object
with few admirers, it's blossomed to be the core technology in
something called AJAX . The Object makes many things easier and neater
than they other would be, and introduces some things that were
otherwise impossible such as HEAD requests to see when a resource was
last modified, or to see if it even exists. It makes your scripting
options more flexible allowing for POST requests without having the
page change, and opens up the possibility of using PUT, DELETE etc.
These methods are increasingly used to provide richer Web Applications
like G-Mail that use lower bandwidth and offer snappier user
interaction.
- Ajax
Tutorial
Getting to a semi-usable point with my system took me about a week of part-time digging, and coding.
This was done on evenings, and only when I could get an hour here and there to work on it.
My goal was three-fold.
1. The ability to have PHP output discrete portions of a page (a major part of AJAX)
2. To be able to take those different pieces and have a simple way to update the html page
3. To be able to submit form information to a script and have the results returned as in point 1
- AJAX: Instant Tutorial
After
taking a look at this tutorial and a couple others, I was dissapointed
at the quality of the code so here’s a quick tutorial to get you jump
started with AJAX (Asynchronous JavaScript + XML). I am using object
detection and explain some of the caveats for doing what I am doing.
Simply put, AJAX allows you to make a call to an http server (typically
an RSS feed or a webpage), get it’s content and load them into your
existing page without having to refresh the whole page. This means that
services like email don’t have to reload the whole page everytime you
click a message, saving on bandwidth (loading the header/footer all
over again) and making things more efficient.
- A Simpler Ajax Path
I
began working with web applications back in the bad old days, when
making an application behave like a desktop app meant wrestling with
byzantine table-based layouts nested five and six levels deep, and
horrid, hackish frame sets within frame sets within frame sets. Those
were the days. Things have steadily improved for web developers with
the advent of standards-compliant browsers, CSS, DHTML, and the DOM.
Pervasive broadband access has made web apps feel a lot snappier. Now
something called the XMLHttpRequest object makes it even easier to
develop full-blown, super interactive applications to deploy in the
browser.
- The Hows and Whys of Degradable Ajax
While
working on Particle tree's shopping cart system for our magazine, we
decided that we wanted to create a flawless user experience for all
users without having to sacrifice the added user interface benefits
provided by Ajax goodness. A lot of places will tell you that it is ok
to use JavaScript and Ajax as long as it’s not mission critical. Well,
we don’t think web apps have to be boring to be reliable. And so we’ve
developed some solid strategies to help us use Ajax in our apps without
having to worry if they’re essential or not to the application. After
some heavy experimenting, we’ve developed a method for making web pages
work regardless of the user’s browser settings. While other sites have
implemented their own versions of degradable Ajax, we found the lack of
documentation on the subject discouraging. And so it is with great
pleasure that we present to you the Particle tree method of degradable
Ajax.
- Remote Scripting with AJAX
This
two-part series of articles covers remote scripting using the AJAX
XMLHttpRequest protocol. Part one walks through an example application
that demonstrates how to implement the protocol, while part two will
show how to create a usable interface. To begin, download the code
archive, which contains all of the files you'll need to create the
working examples presented here and for the upcoming second part of
this series. Essentially, remote scripting allows client-side
JavaScript to request data from a server without having to refresh the
web page. That's it. Everything else that goes into making a seamless
web application draws upon the established methods of manipulating the
Document Object Model. However, remote scripting and seamless
applications bring with them a host of problems from the desktop
application design realm, making those same issues possible on the Web.
- AJAX made simple with DWR
AJAX,
or Asynchronous JavaScript and XML, describes a Web development
technique for creating interactive Web applications using a combination
of HTML (or XHTML) and Cascading Style Sheets for presenting
information; Document Object Model (DOM); JavaScript, to dynamically
display and interact with the information presented; and the
XMLHttpRequest object to interchange and manipulate data asynchronously
with the Web server. Many examples on the Internet show all the
necessary steps for using XMLHttpRequest to communicate with the server
from within an HTML file. When manually writing and maintaining the
XMLHttpRequest code, a developer must deal with many potential
problems, especially with cross-browser compatibilities like different
DOM implementations. This can lead to countless hours spent coding and
debugging JavaScript code, which is not known to be developer friendly.
- An Introduction To Ajax
As
J2EE developers, it seems we are constantly focused on "backend
mechanics." Often, we forget that the main success of J2EE has been
around the Web application; people love developing applications that
utilize the Web for many reasons, but mainly because the ease of
deployment allows a site to have millions of users with minimal cost.
Unfortunately, over the years we have invested too much time in the
back end and not enough time in making our Web user interfaces natural
and responsive to our users. This article introduces a methodology,
Ajax, you can use to build more dynamic and responsive Web
applications. The key lies in the combination of browser-side
JavaScript, DHTML, and asynchronous communication with the server. This
article also demonstrates just how easy it is to start using this
approach, by leveraging an Ajax framework (DWR) to construct an
application that communicates with backend services directly from the
browser. If used properly, this tremendous power allows your
application to be more natural and responsive to your users, thereby
providing an improved browsing experience.
- Developing AJAX Applications the Easy Way
AJAX
is the buzzword of the moment among web developers, so much so that you
could be sick of introductions to AJAX by now (if that's the case, skip
down to "The Chat Web Page"). AJAX is a technology that is hotly
debated from many angles, but it has stuck because it encapsulates
something that is new from a user's perspective. The functionally that
is newly available to all web users is "in-page replacement": the
ability for a web page to change using data from a web server without
totally redrawing itself. This functionality has been around in Mozilla
and Internet Explorer for a while, but it is only recently that Safari
and Konqueror users have been able to join in. AJAX isn't the best
acronym in the world: it stands for Asynchronous JavaScript and XML.
This does nothing to describe the benefits to a user: the technology
behind it does not have to be asynchronous, and the best
implementations don't necessarily use XML, either. However, the
buzzword has stuck so we are better off going with the flow now.
- Ajax on Rails
In
a few short months, Ajax has moved from an obscure and rarely used
technology to the hottest thing since sliced bread. This article
introduces the incredibly easy-to-use Ajax support that is part of the
Ruby on Rails web application framework. This is not a step-by-step
tutorial, and I assume that you know a little bit about how to organize
and construct a Rails web application. If you need a quick refresher,
check out Rolling with Ruby on Rails, Part 1 and Part 2. In the
beginning, there was the World Wide Web. Compared with desktop
applications, web applications were slow and clunky. People liked web
applications anyway because they were conveniently available from
anywhere, on any computer that had a browser. Then Microsoft
created XMLHttpRequest in Internet Explorer 5, which let browser-side
JavaScript communicate with the web server in the background without
requiring the browser to display a new web page. That made it possible
to develop more fluid and responsive web applications.
- Ajax Mistakes
Ajax is also a dangerous technology
for web developers, its power introduces a huge amount of UI problems
as well as server side state problems and server load problems. I’ve
compiled a list of the many mistakes developers using Ajax often make.
Sure Ajax is cool, and developers love to play with cool technology,
but Ajax is a tool not a toy. A lot of the new Ajax applications are
really just little toys, not developed for any real purpose, just
experiments in what Ajax can do or trying to fit Ajax somewhere where
it isn’t needed. Toys might be fun for a little while, but toys are not
useful applications. The back button is a great feature of standard web
site user interfaces. Unfortunately, the back button doesn’t mesh very
well with JavaScript. Keeping back button functionality is a major
reason not to go with a pure JavaScript web app.
|
|