Copyrighted Material

Total Page:16

File Type:pdf, Size:1020Kb

Copyrighted Material 21_785970 bindex.qxp 1/20/06 12:28 PM Page 337 Index >= (greater-than-or-equal-to) operator, • Symbols • function of, 54 + (addition) operator, function of, 52 ++ (increment) operator, function of, 52 += (addition sign, equal sign) operator, += (joining strings) operator, function of, 53 function of, 52 &= (ampersand, equal sign) operator, << (left shift) operator, function of, 53 function of, 53 < (less-than) operator, function of, 54 *= (asterisk, equal sign) operator, <<= (less-than sign, less-than sign, equal function of, 53 sign) operator, function of, 54 */ (asterisk, slash), writing PHP script >? (less-than sign, question mark), comments and, 301 enclosing PHP script in, 298 /= (backslash, equal sign) operator, <= (less-than-or-equal-to) operator, function of, 53 function of, 54 & (bitwise AND) operator, function of, 52 && (logical AND) operator, function ~ (bitwise NOT) operator, function of, 53 of, 52 | (bitwise OR) operator, function of, 52 ! (logical NOT) operator, function of, 52 ^ (bitwise XOR) operator, function of, 52 | | (logical OR) operator, function of, 52 ^= (caret, equal sign) operator, * (multiplication) operator, function function of, 53 of, 52 , (comma) operator, function of, 55 \n (newline character), in PHP , (comma), passing multiple arguments script, 319 to JavaScript functions, 47–48 != (not-equal-to) operator, function of, 54 ?: (conditional) operator, function of, 55 () (parentheses), passing single argu- -- (decrement) operator, function of, 52 ment to JavaScript function and, / (division) operator, function of, 52 44–45 $ (dollar sign), indicating PHP script %= (percent sign, equal sign) operator, variables, 301–302 function of, 53 // (double slash) marker, adding “” (quotation marks) comments to JavaScript with, 28–29 passing JavaScript functions and, 157 = (equal sign) operator, function of, 53 using in JavaScript, 36–37 == (equality) operator, function of, 54 ; (semicolon) > (greater-than) operator,COPYRIGHTED function of, 54 ending MATERIAL JavaScript lines with, 28 >>= (greater-than sign, greater-than sign, ending PHP script lines with, 28 equal sign) operator, function of, 54 # (sharp sign), assigning styles and, 274 >>>= (greater-than sign, greater-than >> (sign-propagating right shift) sign, greater-than sign, equal sign) operator, function of, 53 operator, function of, 54 /* (slash, asterisk), writing PHP script <? (greater-than sign, question mark), comments and, 301 enclosing PHP script in, 298 === (strict equality) operator, function of, 54 21_785970 bindex.qxp 1/20/06 12:28 PM Page 338 338 Ajax For Dummies + (string addition) operator, function Ajax Gold library of, 52 describing getDataReturnText - (subtraction) operator, function of, 52 function, 158–159 -= (subtraction sign, equal sign) describing getDataReturnXml operator, function of, 53 function, 162–163 |= (vertical line, equal sign) operator, describing postDataReturnText function of, 54 function, 166–170 >>> (zero-fill right shift) operator, describing postDataReturnXML function of, 53 function, 170 overview, 157 verifying loading and availability of, • A • 161–162 abort method Ajax Matters Web site, 332–333 Firefox and Navigator, 82 Ajax Patterns Web site, 332 Internet Explorer, 81 Ajax Tags Library, handling JavaServer Safari, 83 Pages with, 229–231 absolute positioning, of Web page AJAXLib framework, using, 174–176 elements, 292–295 alert box, overview, 69–71 absolute URLs, versus relative, 90–91 ampersand, equal sign (&=) operator, action attribute, setting in PHP function of, 53 script, 310 anonymous functions actions, responding to, 33 creating, 55 Adaptive Path Web site, 331–332 handling asynchronous downloads and, addem function 86, 111 creating JavaScript for use in browsers Apache Tomcat (Java-based server), 225 with Xajax and, 218–220 Apple Safari in Sajax, 215–217 alternate ways of retrieving XMLHttp in Xajax, 218–220 Request object in, 92–93 addition (+) operator, function of, 52 Web sites for XMLHttpRequest addition sign, equal sign (+=) operator, objects references, 333 function of, 53 XMLHttpRequest object methods “Ajax: A New Approach to Web for, 83 Applications” (Garrett), 11, 331–332 XMLHttpRequest object properties Ajax blogs, 333 for, 82–83 Ajax discussion group, 334–335 applications, autocomplete, 13–14 Ajax Gold Framework arguments overview, 157–158 passing multiple to JavaScript function, posting data to and retrieving text from 47–48 server with POST method, 166–170 passing single to JavaScript functions, posting data to and retrieving XML 44–45 from server with POST method, arithmetic operators, functions of, 52 170–173 arrays using GET method to retrieve text, overview, 66–67 158–162 retrieving data from text fields in PHP using GET method to retrieve XML, script and, 311–312 162–165 storing extracted XML data, 103 21_785970 bindex.qxp 1/20/06 12:28 PM Page 339 Index 339 turning text into, 282–283 bitwise AND (&) operator, function of, 52 while loop and, 67–69 bitwise NOT (~) operator, function of, 53 working with multiple XMLHttp bitwise operators, functions of, 52–53 Request objects and, 146–147 bitwise OR (|) operator, function of, 52 ASP.NET, 234 bitwise XOR (^) operator, function of, 52 assignment operators, functions of, block elements, overview, 45 53–54 blogs, Ajax, 333 asterisk, equal sign (*=) operator, bookmarks, Ajax disabling browser, function of, 53 325–326 asterisk, slash (*/), writing PHP script bottom property comments and, 301 absolute positioning function of, 293 asyncFlag parameter, for open relative positioning function of, 295 method, 84 boxes asynchronous downloads, handling, alert, 69–71 85–88 populating list with Direct Web Atlas Client Script Framework, 234 Remoting, 227 attributes property, function of, 244 positioning for, 292 autocomplete using PHP script with check, 312–314 capabilities, 13–14 browser events with JPSpan framework, 224 calling JavaScript functions and, 40–44 with Ruby on Rails framework, 233 common JavaScript in Ajax using Ajax Tags Library, 230 applications, 34 Autocomplete JSP tag, 230 working with, 35–36 browsers. See also specific browsers accessing from JavaScript, 26–27 • B • Ajax disabling back button in, 325–326 back button, Ajax disabling browser, Ajax disabling bookmarks in, 325–326 325–326 avoiding cache in, 329 Backbase framework, 234 avoiding sluggish, 328 background-attachment property, awareness of various, 327 function of, 289 calling different Web domains and, background-color property, 130–131 function of, 289 creating Ajax JavaScript for use in with background-image property, Xajax, 218–220 function of, 289 data validation in, 132 background-position property, determining if code will work with, 79 function of, 289 determining type with conditions, backgrounds, setting with cascading 62–64 style sheets, 289–292 downloading images with Ajax and backslash, equal sign (/=) operator, Dynamic HTML, 154–156 function of, 53 handling drag-and-drop events, 183 backup plans, for working offline, 328 handling mouse events, 185 bgcolor property, setting, 35–36 handling older with HTMLHttpRequest binary data objects, downloading with framework, 199–200 Ajax and Dynamic HTML, 156 identifying JavaScript errors and, 30–32 21_785970 bindex.qxp 1/20/06 12:28 PM Page 340 340 Ajax For Dummies browsers. See also specific browsers setting colors and backgrounds with, (continued) 289–292 JavaScript working with various, 32–33 styling text with, 287–288 listening for mouse move events, 187 channel property, Firefox and retrieving text with Ajax, 21–22 Navigator, 82 sending text to with PHP script, 299 chatting sending XML to with PHP script, Ajax-based, 14–15 299–300 with Direct Web Remoting, 227 setting up for debugging, 140–142 check boxes, using with PHP script, buttons. See also HTML controls 312–314 displaying messages by clicking, 69–71 checkUsername function, data reading text fields by clicking, 71–72 validation and, 133 retrieving data from server and childNodes property, function of, 244 displaying by clicking, 76–78 clearCache () function, in libXml Request framework library, 177 color property, function of, 289 • C • colors caching browsers understanding, 36 avoiding, 329 setting with cascading style sheets, controlling with libXmlRequest 289–292 framework library, 177 comma (,) operator, function of, 55 Http framework handling, 211–212 comma (,), passing multiple arguments Interactive Website Framework to JavaScript functions, 47–48 preventing, 198 comments callback functions adding to JavaScript, 28–29 defined, 157 in PHP script, 301 in libXmlRequest framework companion Web site, downloading library, 177 examples from, 22–23 posting data to and retrieving text from comparison operators, functions of, 54 server with, 166–167 conditional (?:) operator, function of, 55 retrieving text from URLs, 162 conditions working with Sajax and, 217 determining browser type in JavaScript Callout JSP tag, 230 with, 62–64 caret, equal sign (^=) operator, testing in JavaScript, 59 function of, 53 using JavaScript if statement and, cascading style sheets (CSS) 59–60 absolute positioning, 292–295 using PHP script else statement and, Ajax programmers’ fondness of, 269 307 coloring shopping cart and items with using PHP script if statement and, styles, 184–185 306–307 making Web page changes stand out, Couvreur, Julien (XMLHttpRequest 285–286 debugger developer), 140 overview, 270–271 CSS (cascading style sheets) relative positioning, 295–296 absolute positioning, 292–295 Ajax programmers’ fondness of, 269 21_785970 bindex.qxp 1/20/06 12:28 PM Page 341 Index
Recommended publications
  • Javascript Hijacking Brian Chess, Yekaterina Tsipenyuk O'neil, Jacob West
    JavaScript Hijacking Brian Chess, Yekaterina Tsipenyuk O'Neil, Jacob West March 12, 2007 Summary An increasing number of rich Web applications, often called AJAX applications, make use of JavaScript as a data transport mechanism. This paper describes a vulnerability we term JavaScript Hijacking, which allows an unauthorized party to read sensitive data contained in JavaScript messages. The attack works by using a <script> tag to circumvent the Same Origin Policy enforced by Web browsers. Traditional Web applications are not vulnerable because they do not use JavaScript as a data transport mechanism. We analyzed the 12 most popular AJAX frameworks, including 4 server-integrated toolkits – Direct Web Remoting (DWR), Microsoft ASP.NET AJAX (a.k.a. Atlas), XAJAX and Google Web Toolkit (GWT) -- and 8 purely client-side libraries -- Prototype, Script.aculo.us, Dojo, Moo.fx, jQuery, Yahoo! UI, Rico, and MochiKit. We determined that among them only DWR 2.0 implements mechanisms for preventing JavaScript Hijacking. The rest of the frameworks do not explicitly provide any protection and do not mention any security concerns in their documentation. Many programmers are not using any of these frameworks, but based on our findings with the frameworks, we believe that many custom-built applications are also vulnerable. An application may be vulnerable if it: • Uses JavaScript as a data transfer format • Handles sensitive data We advocate a two-pronged mitigation approach that allows applications to decline malicious requests and prevent attackers from directly executing JavaScript the applications generate. 1. Introduction1 Although the term “Web 2.0” does not have a rigorous definition, it is commonly used in at least two ways.
    [Show full text]
  • Ajax for Dummies (2006).Pdf
    01_785970 ffirs.qxp 1/20/06 10:51 AM Page iii Ajax FOR DUMmIES‰ by Steve Holzner, PhD 01_785970 ffirs.qxp 1/20/06 10:51 AM Page ii 01_785970 ffirs.qxp 1/20/06 10:51 AM Page i Ajax FOR DUMmIES‰ 01_785970 ffirs.qxp 1/20/06 10:51 AM Page ii 01_785970 ffirs.qxp 1/20/06 10:51 AM Page iii Ajax FOR DUMmIES‰ by Steve Holzner, PhD 01_785970 ffirs.qxp 1/20/06 10:51 AM Page iv Ajax For Dummies® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permit- ted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc.
    [Show full text]
  • Copyrighted Material
    15_043067 bindex.qxd 6/15/06 7:38 PM Page 330 INDEX accessing XML on server, 172–173 A downloading and installing, 170–171, 176 absolute positioning, 288–289 downloading XML data, 174–175 add function, 40–41 stripping out whitespace, 172, 173, 174 addition function for XML data extraction, 82–83 URL encoding, 171 addition operator (+) (JavaScript), 40, 44, 45 alert boxes Ajax (Asynchronous JavaScript + XML). See also Ajax display by JavaScript function, 30–31 XMLHttpRequest frameworks; object displaying, 28–29 advantages, 2, 3, 62 displaying text from text fields, 37 attributes, 29, 262–263 aligning text in CSS, 278–279 downloading JavaScript, 94–95 AND logical operator (JavaScript), 53 event attributes, 29 anonymous JavaScript functions, 68 example of data Submit and fetch, 4–5 Apache Tomcat Java-based server, 231 XMLHttpRequest importance of object, 62 Apple Safari, 63 server-side scripts and PHP used with, 76–77 arguments, passing to functions, 38–39 Ajax frameworks arithmetic operators (JavaScript), 45 ! caution: importance of files and placement, 152 assignment operators (JavaScript), 44, 45 resultXML ! caution: naming global variable “ ”, 171, 175 asynchronous versus synchronous requests, ! caution: on use of global variables, 155, 159 178, 180 advantages, 152–153 attributes (Ajax), 29, 262–263 Ajax tag library, 236–239 autocomplete capability AJAXLib Ajax framework, 170–175 example demonstration site, 8–9 browser-based versus server-side, 152 support for, in Ajax tag library, 236–237 downloadable and free, 182 installing and allowing
    [Show full text]
  • Javascript Hijacking
    JavaScript Hijacking Brian Chess, Yekaterina Tsipenyuk O'Neil, Jacob West {brian, katrina, jacob}@fortifysoftware.com March 12, 2007 Summary An increasing number of rich Web applications, often called Ajax applications, make use of JavaScript as a data transport mechanism. This paper describes a vulnerability we term JavaScript Hijacking, which allows an unauthorized party to read confidential data contained in JavaScript messages. The attack works by using a <script> tag to circumvent the Same Origin Policy enforced by Web browsers. Traditional Web applications are not vulnerable because they do not use JavaScript as a data transport mechanism. We analyzed 12 popular Ajax frameworks, including 4 server-integrated toolkits – Direct Web Remoting (DWR), Microsoft ASP.NET Ajax (a.k.a. Atlas), xajax and Google Web Toolkit (GWT) -- and 8 purely client-side libraries -- Prototype, Script.aculo.us, Dojo, Moo.fx, jQuery, Yahoo! UI, Rico, and MochiKit. We determined that among them only DWR 2.0 implements mechanisms for preventing JavaScript Hijacking. The rest of the frameworks do not explicitly provide any protection and do not mention any security concerns in their documentation. Many programmers are not using any of these frameworks, but based on our findings with the frameworks, we believe that many custom-built applications are also vulnerable. An application may be vulnerable if it: • Uses JavaScript as a data transfer format • Handles confidential data We advocate a two-pronged mitigation approach that allows applications to decline malicious requests and prevent attackers from directly executing JavaScript the applications generate. 1. Introduction Although the term “Web 2.0” does not have a rigorous definition, it is commonly used in at least two ways.
    [Show full text]
  • Ajax, State of The
    AjAjaax,x, ststaattee ooff tthhee aarrtt Tarek Ziadé, Nuxeo [email protected] WWhhoo aamm ii ● I am engineer at Nuxeo ● I work on CPS, the famous ECM Plateform ;) ● I©ve been lately in charge of Ajax stuff in CPS ● I read Ajax related feeds before I go to bed WWhhaatt iiss AAjjaaxx ?? A dutch football club (a good one) A cleanser (really works) AA WWeebb 22..00 tteechchnnoollooggyy Asynchronous Javascript And XML WWhhaatt©©ss WWeebb 22..00 ?? TTiimm OO©©RReeiillllyy©©ss ©©ccoommppaacctt©© ddeeffiinniittiioonn:: Web 2.0 is the network as platform, spanning all connected devices; Web 2.0 applications are those that make the most of the intrinsic advantages of that platform: delivering software as a continually-updated service that gets better the more people use it, consuming and remixing data from multiple sources, including individual users, while providing their own data and services in a form that allows remixing by others, creating network effects through an "architecture of participation," and going beyond the page metaphor of Web 1.0 to deliver rich user experiences. MMaarrkkuuss AAnnggeerrmmeeiieerr©©ss vviieeww ooff WWeebb 22..00:: (courtesy of Markus Angermeier) WWeebb 22..00 AAppppss ✔ del.icio.us ✔ flickr ✔ Voo2do ✔ Digg ✔ Google Mail (Gmail) ✔ Writely ✔ Basecamp ✔ ... AjAjaaxx bbiigg ppiictctuurere 11//22 (courtesy of J. J. Garett) AjAjaaxx bbiigg ppiictctuurere 22//22 (courtesy of J. J. Garett) TThhee LLiistst ooff tthhiinnggss AjAjaaxx rereaallllyy bbririnnggss ✔ Increases interactivity ✔ Save bandwidth ✔ Helps avoiding some interactive
    [Show full text]
  • Integrating AJAX Approach Into GIS Visualization Web Services
    Integrating AJAX Approach into GIS Visualization Web Services Ahmet Sayar1, 2, *, Marlon Pierce1 and Geoffrey Fox 1, 2, 3, 4 1 Community Grids Lab, Indiana University, Bloomington, Indiana, 47404, USA 2Department of Computer Science, Indiana University 3Department of Physics, Indiana University 4School of Informatics, Indiana University {asayar, mpierce, gcf}@cs.indiana.edu Abstract XML and HTTP as AJAX does. Since AJAX and Web Services are XML based structures they are able to As the Web platform continues to mature, we see an leverage each others strength. increasing number of amazing technologies that take Geographic Information Systems (GIS) visualization In this paper, we first give some background applications to new levels of power and usability. By information about the web technologies we have been integrating new powerful technologies into GIS using in our proposed architecture. These are basically systems, we get higher performance results with AJAX, Web Services, and GIS Web Services. In additional functionalities. The most recent Section 3 we mention some related works about the development capturing the attention of the browser AJAX and Web Services. In Section 4 we first give a based application developers is AJAX (Asynchronous generic architecture for integration of any Web JavaScript and XML). In this paper we present a Services and AJAX. Then, we give sample usage generic and performance efficient framework for scenarios to prove our integration concepts; one of integrating AJAX models into the browser based GIS them is for Google and GIS Data Server (WFS) Visualization Web Services systems. integration and the other one is for Google and GIS Mapping Server (WMS) integration.
    [Show full text]
  • Mastering Ajax, Part 1: Introduction to Ajax Understanding Ajax, a Productive Approach to Building Web Sites, and How It Works
    Mastering Ajax, Part 1: Introduction to Ajax Understanding Ajax, a productive approach to building Web sites, and how it works Skill Level: Introductory Brett McLaughlin ([email protected]) Author and Editor O'Reilly Media Inc. 06 Dec 2005 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. However, Ajax is far more than just a fad; it's a powerful approach to building Web sites and it's not nearly as hard to learn as an entire new language. Before I dig into what Ajax is, though, let's spend just a few moments understanding what Ajax does. When you write an application today, you have two basic choices: • Desktop applications • Web applications These are both familiar; desktop applications usually come on a CD (or sometimes are downloaded from a Web site) and install completely on your computer. They Introduction to Ajax © Copyright IBM Corporation 1994, 2008.
    [Show full text]
  • The Web 2.0 Demystified – Six Theses on a Misinterpreted Concept
    Chapter 4 – Applications and Impacts The Web 2.0 Demystified – Six Theses on a Misinterpreted Concept H.D.Hofmann1 and M.H.Knahl2 1University of Cooperative Education, Mannheim, Germany 2Centre for Information Security and Network Research, University of Plymouth, United Kingdom e-mail: [email protected], [email protected] Abstract The Web 2.0 was said to bring real innovation, new concepts, and new applications to the Web. The role of a user is upgraded by changing his passive role of information consumer to the role of somebody producing and consuming information at the same time ("prosumer"). In our paper, we discuss the major aspects of the concept Web 2.0 and draw conclusions from our findings by means of theses. It is argued that technologies used with Web 2.0 do not represent an innovative factor. We discuss technical aspects such as technologies and programming interfaces as well as usability aspects and business aspects of Web 2.0 applications and give an outlook to future developments and new concepts used on the Web. Based on the derived theses it is proposed that the Web 3.0 will bring new concepts and applications to the web rather than the Web 2.0. Keywords Web 2.0, Web 3.0, Internet Applications, AJAX 1. Web 2.0 - old wine in new skins? The past 10-15 have seen a rapid development and adoption of Internet services. Business managers have been enthused but also alarmed by a rapidly proliferating series of developments to the internet and web based services that alter consumer behaviour and have the potential to transform business models (Cassidy, 2002; Tapscott and Williams, 2007).
    [Show full text]
  • Ingeniería Del Software II: AJAX Vs Silverlight
    Ingeniería del Software II: AJAX vs Silverlight Diego Martín-Serrano Fernández Francisco José Oteo Fernández Jesús Martínez-Campos Martínez Índice 1. Introducción a Ajax...............................................................................................................3 2. Profundizando en Ajax.........................................................................................................4 2.1. Frameworks para desarrollo Ajax.....................................................................................5 3. Conclusión sobre Ajax.........................................................................................................6 4. Introducción a Silverlight......................................................................................................7 5. Profundizando en Silverlight................................................................................................8 6. Conclusión sobre Silverlight..............................................................................................10 7. Comparativa Ajax vs Silverlight..........................................................................................11 8. Bibliografía..........................................................................................................................14 Índice de tablas Tabla 1. Posibles valores del atributo readyState del objeto XMLHTTPRequest....................4 Tabla 2. Frameworks para el lado del servidor, según el lenguaje de programación.............6 Tabla 3. Comparativa características
    [Show full text]
  • Using Ajax with PHP and Sajax How the Simple Ajax Toolkit Can Integrate Your Server-Side PHP with Javascript
    Using Ajax with PHP and Sajax How the Simple Ajax Toolkit can integrate your server-side PHP with JavaScript Skill Level: Intermediate Tyler Anderson ([email protected]) Freelance Writer Stexar Corp. 18 Oct 2005 Updated 05 Jul 2006 For years, the goal of creating a truly responsive Web application was hampered by one simple fact of Web development: To change the information on part of a page, a user must reload the entire page. Not anymore. Thanks to asynchronous JavaScript and XML (Ajax), we can now request new content from the server and change just part of a page. This tutorial explains how to use Ajax with PHP and introduces the Simple Ajax Toolkit (Sajax), a tool written in PHP that lets you integrate server-side PHP with JavaScript that makes this work. Section 1. Before you start This tutorial is for those interested in developing rich Web applications that dynamically update content using asynchronous JavaScript and XML (Ajax) with PHP, without having to refresh entire Web pages with each user click. This tutorial assumes basic PHP concepts, including the use of if and switch statements, and functions. About this tutorial Using Ajax with PHP and Sajax © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 1 of 25 developerWorks® ibm.com/developerWorks You will learn about Ajax, as well as issues surrounding its usage. You will also build an Ajax application in PHP that will display panels of a section of a previously written tutorial. Clicking on a panel link will reload only the content section and replace it with the content of the selected panel, saving bandwidth and time loading the page.
    [Show full text]
  • Il Framework XAJAX
    Il framework XAJAX Vincenzo Della Mea (PWLS 6.11, 6.12, 6.13) Complementi di Tecnologie Web – M. Franceschet, V.Della Mea e I.Scagnetto - 1 Sommario • XAJAX – Principi e API • Un esempio semplice: – rivisitazione del cambio di colori dello sfondo della pagina corrente. • Un esempio complesso: – generazione “interattiva” del codice fiscale Complementi di Tecnologie Web – M. Franceschet, V.Della Mea e I.Scagnetto - 2 XAJAX • http://xajaxproject.org/ • Framework in PHP per lo sviluppo di applicazioni AJAX: – generazione automatica delle funzioni Javascript che ruotano attorno a XmlHttpRequest; – codice PHP per l’accesso al DOM della pagina (tradotto ovviamente in Javascript); – non è richiesta nessuna conoscenza di Javascript. Complementi di Tecnologie Web – M. Franceschet, V.Della Mea e I.Scagnetto - 3 XAJAX: Oggetti principali • xajax_core: – xajax – xajaxRequest – xajaxResponse – xajaxControl – xajaxPlugin • xajax_js: – DOM, events, CSS, … • xajax_controls: validatori (X)HTML, … • xajax_plugins: GoogleMaps, HTML table Complementi di Tecnologie Web – M. Franceschet, V.Della Mea e I.Scagnetto - 4 Tipico pattern di utilizzo • Solitamente si creano tre file PHP: – un file di configurazione, – un file per la componente lato server, – un file per la componente lato client. • Il file di configurazione viene incluso ed utilizzato dagli altri due. Complementi di Tecnologie Web – M. Franceschet, V.Della Mea e I.Scagnetto - 5 XAJAX: cosa fare • Configurazione: – si include la libreria di classi xajax per mezzo del file xajax.inc.php; – si dichiara ed istanzia un oggetto xajax; – si registrano i nomi delle funzioni fornite dal server e chiamate asincronamente dal client. • Server: – si include la configurazione; – si definiscono le funzioni registrate in modo che ritornino valori o modifichino il DOM; – si elaborano le richieste con apposito metodo processRequest.
    [Show full text]
  • XAJAX: Una Librería De AJAX Para PHP (Parte 1)
    XAJAX: una librería de AJAX para PHP (parte 1) AJAX es el acrónimo de Asynchronous Javascript And XML o Javascript y XML asíncronos dicho en nuestro idioma. Se trata de una combinación de tecnologías que se ha popularizado muchísimo desde hace unos años con la irrupción de la Web 2.0 y lo podemos encontrar en infinidad de páginas y servicios web como Gmail, Google Maps, Hotmail, Flickr y un largo etcétera. La clave de AJAX está en que es asíncrono, es decir, permite que la página del cliente realice peticiones al servidor sin recargar la página. Sólo se actualizan las partes de la página que nos interesan pero sin tener que recargar la página entera, lo que proporciona una sensación de navegación mucho más fluida. Para introducirnos en el mundo de AJAX vamos a utilizar una librería llamada XAJAX que nos permite aprovechar las capacidades de AJAX en nuestras páginas PHP. Podéis descargar esta librería en la página del proyecto http://xajaxproject.org/ A continuación, unos de códigos de ejemplo que se presentarán en diferentes capítulos para que sean más fáciles de leer. También se puede descargar la versión PDF con todos los ejemplos aquí. Y un Zip con los códigos fuente. Ejemplo 1. Introducción a la librería. Comencemos con un simple ‘Hola, mundo’ para ir calentando. En esta ocasión lo ponemos todo en el mismo archivo PHP llamado ‘holaAjax.php’. ‘holaAjax.php’ <?php require ('xajax/xajax.inc.php'); $xajax = new xajax(); function cambia_texto($mensaje){ $respuesta = new xajaxResponse(); $respuesta->addAssign("mensaje","innerHTML",$mensaje); return $respuesta; } $xajax->registerFunction("cambia_texto"); $xajax->processRequests(); ?> <html> <head> <?php $xajax->printJavascript("xajax/"); ?> </head> <body> <input type="button" onclick="xajax_cambia_texto('Hola Ajax);" value="Pulsa" /> <div id="mensaje"></div> </body> </html> Explicación: Lo primero que debemos hacer es importar la librería de xajax y crear una instancia de xajax: require ('xajax/xajax.inc.php'); xajax = new xajax(); A continuación definimos las funciones que se van a utilizar.
    [Show full text]