tag:blogger.com,1999:blog-79437983742576548942024-03-08T06:45:46.581-08:00Ajax's TutorialLangkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-7943798374257654894.post-44217438259069207352008-09-17T00:29:00.000-07:002008-09-17T00:30:40.275-07:00AJAX Introduction<p class="intro">AJAX stands for Asynchronous JavaScript And XML.</p> <hr /> <h2>What You Should Already Know</h2> <p>Before you continue you should have a basic understanding of the following:</p> <ul><li>HTML / XHTML</li><li>JavaScript</li></ul> <p>If you want to study these subjects first, find the tutorials on our <a href="http://www.w3schools.com/default.asp">Home page</a>.</p> <hr /> <h2>AJAX = Asynchronous JavaScript and XML</h2> <p>AJAX is not a new programming language, but a technique for creating better, faster, and more interactive web applications.</p> <p>With AJAX, your JavaScript can communicate directly with the server, using the JavaScript <b>XMLHttpRequest</b> object. With this object, your JavaScript can trade data with a web server, without reloading the page.</p> <p>AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.</p> <p>The AJAX technique makes Internet applications smaller, faster and more user-friendly.</p> <p><img src="http://www.w3schools.com/images/lamp.gif" alt="lamp" border="0" height="15" width="15" /> AJAX is a browser technology independent of web server software. </p> <hr /> <h2>AJAX is Based on Web Standards</h2> <p>AJAX is based on the following web standards:</p> <ul><li><b>JavaScript</b></li><li><b>XML</b></li><li><b>HTML</b></li><li><b>CSS</b></li></ul> <p>The web standards used in AJAX are well defined, and supported by all major browsers. AJAX applications are browser and platform independent.</p> <hr /> <h2>AJAX is About Better Internet Applications</h2> <p>Web applications have many benefits over desktop applications; they can reach a larger audience, they are easier to install and support, and easier to develop.</p> <p>However, Internet applications are not always as "rich" and user-friendly as traditional desktop applications. </p> <p>With AJAX, Internet applications can be made richer and more user-friendly.</p> <hr /> <h2>You Can Start Using AJAX Today</h2> <p>There is nothing new to learn.</p> <p>AJAX is based on existing standards. These standards have been used by most developers for several years.</p><p><a href="http://www.w3schools.com/Ajax/ajax_intro.asp">Readmore..........</a></p><p>From : <a href="http://www.w3schools.com/Ajax/ajax_intro.asp">http://www.w3schools.com/Ajax/ajax_intro.asp</a><br /></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-7753238404696854942008-09-17T00:26:00.000-07:002008-09-17T00:29:24.919-07:00AJAX Uses HTTP Requests<p>In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user information to a server, you will have to make an HTML form and GET or POST data to the server. The user will have to click the "Submit" button to send/get the information, wait for the server to respond, then a new page will load with the results.</p> <p>Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly.</p> <p>With AJAX, your JavaScript communicates directly with the server, through the JavaScript <b>XMLHttpRequest</b> object</p> <p>With an HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.</p> <hr /> <h2>The XMLHttpRequest Object</h2> <p><b>By using the XMLHttpRequest object, a web developer can update a page with data from the server after the page has loaded!</b></p> <p>AJAX was made popular in 2005 by Google (with Google Suggest).</p> <p><a target="_blank" href="http://www.google.com/webhp?complete=1&hl=en">Google Suggest</a> is using the XMLHttpRequest object to create a very dynamic web interface: When you start typing in Google's search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions.</p> <p>The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7.</p><p><a href="http://www.w3schools.com/Ajax/ajax_httprequest.asp">Readmore.........</a></p><p>From : <a href="http://www.w3schools.com/Ajax/ajax_httprequest.asp">http://www.w3schools.com/Ajax/ajax_httprequest.asp</a><br /></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-6898568191899781982008-09-17T00:24:00.000-07:002008-09-17T00:26:53.266-07:00JavaScript Form Validator number two<p><strong>JavaScript Form Validator</strong></p> <p>This is an updated and improved version of <a href="http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/">AJAX Generic Form Parser</a></p> <p>Our updated JavaScript code is smaller, prettier :) and more powerful (just).</p> <p><b>That’s nice, but what does it do?</b><span style="float: right;"><!--adsense--></span><br />Well it validates your form stupid!! as with most (if not all?) posts on this website, the script is simple, easy to follow and not jam packed with to many features. Basically this script will look for required fields (which you specify in your form.. I’ll come to this later) and if a required field is empty, it will through up a JavaScript alert box telling the user (and prevent the form from being submitted).</p> <p>Before I present to you the Code Example, I’ll explain a little about how to configure your form and make certain fields required.<br />For simplicity, I’ve chosen to make use of the fields ‘Title’ tag. This is where you make fields required.</p> <p>For example: <b><a href="http://www.ajaxtutorial.net/index.php/2007/01/17/javascript-form-validator-number-two/"><b>Readmore.........</b></a></b></p> <p><b>Note:</b> The script will support the following form field types:</p> <ul><li>Text</li><li>Textarea</li><li>Password</li><li>Select</li></ul> <p>Just to recap. To make any of the supported fields required, just add <b>title=”required”</b>!</p> <p><b>Triggering the form to call the JavaScript Validation Script:</b><br />In order for the form to call the JavaScript and check all the required fields, we need to prevent the form from submitting. In order to achieve this, we will use the <b>onSubmit</b> event on the <b>form</b> tag. Example:</p> <p><b><a href="http://www.ajaxtutorial.net/index.php/2007/01/17/javascript-form-validator-number-two/"><b>Readmore.........</b></a></b></p> <p>We must use <b>return</b> before the function call, this tells to form ‘do not submit the form unless the function returns true’.</p> <p><b>The JavaScript form Validator Script</b></p><p><a href="http://www.ajaxtutorial.net/index.php/2007/01/17/javascript-form-validator-number-two/"><b>Readmore.........</b></a></p><p><b>From : <a href="http://www.ajaxtutorial.net/index.php/2007/01/17/javascript-form-validator-number-two/">http://www.ajaxtutorial.net/index.php/2007/01/17/javascript-form-validator-number-two/</a><br /></b></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-89017454061455550442008-09-17T00:22:00.000-07:002008-09-17T00:24:29.449-07:00ExtJS JavaScript Framework<p><strong>Ext JS, the JavaScript framework with Ajax and UI Components</strong></p> <p><a href="http://www.extjs.com/">Ext JS </a>is a JavaScript Library/Framework which works in conjunction with Prototype, YahooUI and jQuery. It’s probably the most exciting toolkit available for building web 2.0 websites right now. It’s jam packed with features, and is designed to make life much easier for building great UI in JavaScript.</p> <p>I’ll not dig to deep right now, I suggest you check out the <a href="http://extjs.com/deploy/ext/docs/index.html">example and demos</a> first to see what you think.</p> <p>Below is a the script used to grab XML data via Ajax and populate a grid (sortable table like object):</p><p><a href="http://www.ajaxtutorial.net/index.php/2007/04/30/extjs-javascript-framework/">Readmore.......</a></p><p>from : <a href="http://www.ajaxtutorial.net/index.php/2007/04/30/extjs-javascript-framework/">http://www.ajaxtutorial.net/index.php/2007/04/30/extjs-javascript-framework/</a><br /></p><h2 class="posttitle" id="post-24"><a href="http://www.ajaxtutorial.net/index.php/2007/04/30/extjs-javascript-framework/" rel="bookmark" title="Permanent link to ExtJS JavaScript Framework"><br /></a></h2>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-80731004187141090622008-09-17T00:21:00.001-07:002008-09-17T00:22:32.846-07:00Simple Ajax Functions - Snippets<p><strong>Basic Ajax Functions</strong><br />I’ve created a list of very common JavaScript functions for Ajax. They have been created in quick reference fashion and do not contain any fancy stuff. Instead of creating one function which can handle various tasks depending on passed values, they are split into seperate basic task functions. The reason for this is simplicity.</p> <p>Anyway - here they are. I’ll post the function and give a basic outline of what it does.</p> <p>This first function is the real important one - it’s the one which creates the object for making the Ajax connection.</p> <p>Here is the function which sends the request to the server script. This version creats the connection with TEXT and uses the POST method.</p> <p>Here is the function which sends the request to the server script. This version creats the connection with TEXT and uses the GET method.</p> <p>Here is the function which sends the request to the server script. This version creats the connection with XML and uses the POST method.</p> <p>Here is the function which sends the request to the server script. This version creats the connection with XML and uses the GET method.</p> <p>Now here is the function which retrieves the response from the server script. This version receives the response as TEXT (http.responseText).</p> <p>Now here is the function which retrieves the response from the server script. This version receives the response as XML (http.responseXML).</p> <p>This little function can be used to delay the call - handy for forms where you use onKeyUp or onKeyPress to trigger submit action.<br /></p> <pre><code allow="none"><a href="http://www.ajaxtutorial.net/index.php/2006/03/08/simple-ajax-functions-snippets/">Readmore.............</a><br />From : <a href="http://www.ajaxtutorial.net/index.php/2006/03/08/simple-ajax-functions-snippets/">http://www.ajaxtutorial.net/index.php/2006/03/08/simple-ajax-functions-snippets/</a><br /><script type="text/javascript"> <!-- function keyUp() { window.setTimeout("sendRequest()", 400); } // --> </script> </code></pre>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-66768207763211957432008-09-17T00:19:00.000-07:002008-09-17T00:20:44.935-07:00AJAX generic form parser<p>AJAX Generic Form Parser - With Validation:</p> <p>In this tutorial I’ll show you a simple method to pass any HTML form through AJAX without the need to hard code all form fields into the JavaScript or Server Side Script. Using this simple piece of JavaScript you can reuse it as is with any form, saving a lot of time. I’ve even added basic validation to certain form element types (which would be expected).</p><p>Okay, straight to the main JS code. (<a href="http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/">readmore....</a>)</p><p>The JavaScript code above is split into 4 functions, here is an overview of what each function does.</p> <p>createXMLHttpRequest() - This is the function which will establish the AJAX connection object, this is called as soon as the JS file is loaded.</p> <p>sendRequest() - This function is the one which is called when the form is submitted. This function requires (passed in) the ‘Form Object’ and the ‘File Name’ of the script which will receive the form data. When this function has been called, it takes the form object and passes it to the JS function getForm() which in turn parses the whole form extracting all the data. sendRequest() then takes the open AJAX connection and passes all the data to the PHP file form processing. Finally when the request from the PHP server script is returned, it writes out the reply to an element on the screen with the div ID ‘results’.</p> <p>getForm() - This is the magic, this function reads through the whole form and extracts the field data before returning it back to sendRequest(). It handles radio, text, password, textarea, select and checkbox field types. It even looks for validation requests on text, password and textarea fields (which is enabled by using title=”required” in the form element).</p> <p>Simple :)</p><p><a href="http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/">Readmore...........</a></p><p>From : <a href="http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/">http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/</a><br /></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-24785713625419916382008-09-17T00:15:00.000-07:002008-09-17T00:18:02.970-07:00Simple Ajax using Prototype. Part 2<p><b>Ajax Updater - Update a DOM element ID from a Server Script</b></p> <p>This example is probably the simplest example you will ever find. <span style="float: right;"><!--adsense--></span><br />We are going to use the prototype feature ‘ajax.Updater’ (<a href="http://www.ajaxtutorial.net/index.php/2006/11/29/simple-ajax-using-prototype-part-1/">see part one for more details on prototype</a>).</p> <p>ajax.Updater allows you to specify an element ID and script URL - and whatever the script URL prints will appear in your element ID. Simple as that.</p> <p>The example below simply returns the Server time each time the button is clicked.</p> <p>I’m not going to explain this bit by bit as it is just so easy to grasp.</p> <p>Remember, you will need the prototype library in order to use this!</p><p><a href="http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/">Readmore......</a></p><p>From : <a href="http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/">http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/</a><br /></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0tag:blogger.com,1999:blog-7943798374257654894.post-83449106523395388032008-09-17T00:12:00.000-07:002008-09-17T00:15:49.586-07:00Simple Ajax using Prototype. Part 1<p>This is part of one of many such tutorials covering Ajax with Prototype.</p> <p>If you do not want to get your hand to dirty with custom Ajax code, then using the extremely handy toolkit from prototype may be perfect.<br />Prototype is a very well written JavaScript framework/toolkit and come with an Ajax class to make things nice and easy.</p> <p>In this simple example I’ll show you just how easy Ajax calls are. But you will need to have your own <a href="http://prototype.conio.net/">copy of prototype</a> (its free!).</p> <p>On a side note… if you like fancy JavaScript effects, you can extend prototype with another library called <a href="http://script.aculo.us/">script.aculo.us</a> - I promise, with these you will have endless hours of fun!!</p> <p><b>On with the example</b><br />I’ve attempted to simplify things as much as possible. In this tutorial we will type some text into a standard form field, hit a button and see the results appear below. In the background, our button click will trigger our JavaScript function, and pass the text through Ajax to a server-side PHP script. This PHP script will write our text back to an other JavaScript function on our page and print the text out on the screen.</p><a href="http://www.ajaxtutorial.net/index.php/2006/11/29/simple-ajax-using-prototype-part-1/">Read More.......</a><br />From : <a href="http://www.ajaxtutorial.net/index.php/2006/11/29/simple-ajax-using-prototype-part-1/">http://www.ajaxtutorial.net/index.php/2006/11/29/simple-ajax-using-prototype-part-1/</a><br /><p><br /></p>Langkah Kecil untuk Majuhttp://www.blogger.com/profile/04759579235489475736noreply@blogger.com0