Chapter 2. First steps with Ajax
Listing 2.3. Ajax “hello” page
Listing 2.7. Creating an IFrame
Listing 2.8. getXmlDocument() function
Listing 2.9. getXmlHttpRequest() function
Listing 2.10. Using a callback handler
Listing 2.11. Full end-to-end example of document loading using XMLHttpRequest
Chapter 3. Introducing order to Ajax
Listing 3.1. ContentLoader object
Listing 3.2. getLeft() function
Listing 3.3. Singleton TradingMode object in Java
Listing 3.4. Singleton TradingMode object in JavaScript
Listing 3.5. Quick-and-dirty generation of an XML stream from a database query
Listing 3.6. Sample XML output from listing 3.5
Listing 3.7. Object model for our garment store
Listing 3.8. Revised page using ORM to talk to the database
Chapter 4. The page as an application
Listing 4.4. musical_dyn_keys.js
Listing 4.5. musical_dyn_keys.html
Listing 4.6. Changes to musical_dyn_keys.css
Listing 4.9. Revised mousemat.html, using EventRouter
Listing 4.11. ObjectViewer object
Listing 4.12. Using the objViewSpec property
Listing 4.13. Modified autoSpec() function
Listing 4.14. Modified PropertyViewer constructor
Chapter 5. The role of the server
Listing 5.4. showPopup() function and supporting code
Listing 5.6. script_earth.html
Listing 5.11. submitData() function
Listing 5.12. ContentLoader object
Listing 5.13. CommandQueue object
Listing 5.14. UpdatePropertyCommand object
Chapter 6. The user experience
Listing 6.1. CommandQueue object
Listing 6.2. updatePlanets() function
Listing 6.4. Message framework with user interface
Listing 6.5. renderFull() method
Listing 6.6. msg.render() function
Listing 6.8. Modified Message object
Listing 6.9. ContentLoader with notifications
Listing 6.10. Notifications sample page
Chapter 7. Security and Ajax
Listing 7.1. Security-aware ContentLoader object
Listing 7.3. submitGuess() function
Listing 7.4. parseGoogleResponse() function
Listing 7.5. A generic Java security filter
Chapter 8. Performance
Listing 8.1. Timing code with the Date object
Listing 8.3. Timing code with the stopwatch library
Listing 8.4. mousemat.html with profiling
Listing 8.5. Profiling a for loop
Chapter 9. Dynamic double combo
Listing 9.1. The double-combo form
Listing 9.2. The function FillTerritory() initializes the Ajax request.
Listing 9.3. Example of the XML response format
Listing 9.4. DoubleComboXML.aspx.vb: Server-side creation of the XML response
Listing 9.5. Updating the page with data from the XML response
Listing 9.6. The getTransport method
Listing 9.7. The sendRequest method
Listing 9.8. The queryString method
Listing 9.9. The Ajax response handler methods
Listing 9.10. Double-combo HTML markup listing
Listing 9.11. Double-combo HTML modified markup listing
Chapter 10. Type-ahead suggest
Listing 10.1. typeAheadData.aspx.cs
Listing 10.2. Partial listing for commenting out the request lines for testing
Listing 10.3. The basic HTML layout for the type-ahead suggest
Listing 10.4. The JavaScript code to output the positioned span
Listing 10.5. CSS class for drop-down span
Listing 10.6. Building a custom object
Listing 10.7. Initializing the script
Listing 10.8. Attaching the event handlers
Listing 10.9. Global variables used throughout the project
Listing 10.10. The JavaScript code that detects the user’s keypresses
Listing 10.11. Ajax functionality to send data back to the server
Listing 10.12. Transforming the responseText property to a JavaScript array
Listing 10.13. Formatting the results into a displayable format
Listing 10.14. Dynamically finding the position of a nonpositioned element
Listing 10.15. Using regular expressions to limit results
Listing 10.16. Performing string manipulation with JavaScript
Listing 10.17. Changing the CSS class names of elements with JavaScript
Listing 10.18. Handling the arrow keys and mouse click events
Listing 10.19. Attaching and removing timing events
Listing 10.20. Altering the TypeAhead() function to allow for different queries
Listing 10.21. TextSuggest HTML markup
Listing 10.22. TextSuggest constructor
Listing 10.23. Using the Rico ajaxEngine
Listing 10.24. Ajax response handling
Listing 10.25. The behavior injection
Listing 10.26. The TextSuggestKeyHandler constructor
Listing 10.27. The keyboard handler
Listing 10.28. keydownHandler() method
Listing 10.29. TextSuggest selection manipulation methods
Listing 10.30. TextSuggest moveCaretToEnd() method
Listing 10.31. TextSuggest key-up handlers
Listing 10.32. Text input handler
Listing 10.33. Creating the suggestion pop-up UI
Listing 10.34. Positioning the pop-up UI
Listing 10.35. Calculation of left and right padding
Listing 10.36. Creation of suggestion list items
Listing 10.37. Creation of a list item span
Chapter 11. The enhanced Ajax web portal
Listing 11.1. The users table schema
Listing 11.2. LoginFilter.java : server-side login code
Listing 11.4. HTML login layout
Listing 11.5. Login form CSS rules
Listing 11.6. The XMLHttpRequest login request
Listing 11.7. PortalWindow.java
Listing 11.8. SelectServlet.java (mapped to ‘portalLogin.servlet’)
Listing 11.9. getPortalWindows() method
Listing 11.10. SaveWindowProperties() function
Listing 11.11. UpdateServlet.java (mapped to ‘saveSettings.servlet’)
Listing 11.12. savePortalWindows() method
Listing 11.13. Portal creation and login
Listing 11.14. Adaptation of the AjaxWindows.js mouse hander
Chapter 12. Live search using XSLT
Listing 12.1. Client-side form
Listing 12.2. Initiation function
Listing 12.4. XML file with no results
Listing 12.5. phoneXML.php: Server-side XML generation
Listing 12.8. Invoking XSLT for Mozilla
Listing 12.9. Cascading Style Sheet
Listing 12.10. Altering LoadXMLXSLTDoc to support Opera and Safari
Listing 12.11. Altering the GrabNumber function to integrate a bookmarking link
Listing 12.12. Obtaining the querystring value and performing the search
Listing 12.13. The loadView method
Listing 12.14. Setting the XML and XSL documents
Chapter 13. Building stand-alone applications with Ajax
Listing 13.1. Basic HTML for the RSS reader
Listing 13.2. CSS for the holder and header divs
Listing 13.3. CSS for the content divs
Listing 13.4. CSS for the footer div
Listing 13.5. Global constant variables
Listing 13.6. Global variables that maintain the state
Listing 13.7. Preload JavaScript function
Listing 13.8. Formatting the XML results into a JavaScript array
Listing 13.9. Function informing user of preloading functionality
Listing 13.10. Function to handle the errors generated from the XMLHttpRequest
Listing 13.11. CSS Opacity filter classes
Listing 13.12. ChangeView() function
Listing 13.13. JavaScript function to set CSS class and to execute the transition effect
Listing 13.14. JavaScript function to load additional RSS feeds
Listing 13.15. HTML selection list
Listing 13.16. JavaScript function to pause and skip the RSS reader feeds
Listing 13.17. onclick event handlers for button actions
Listing 13.18. Security Privilege Manager code
Listing 13.19. Code placement for loadXMLDoc
Listing 13.20. Code placement for onReadyState
Listing 13.21. The RSSFeed Model class
Listing 13.22. The RSSItem Model class
Listing 13.23. The RSS XML parsing
Listing 13.24. Parsing helper method
Listing 13.25. The RSSItemView View class
Listing 13.26. The HTML generation method
Listing 13.27. The RSSReader constructor
Listing 13.28. The setOptions method
Listing 13.29. The start method
Listing 13.30. The applyButtonBehaviors method
Listing 13.31. The hasPrevious/hasNext method pair
Listing 13.32. The previous() method
Listing 13.33. The next() method
Listing 13.34. The slideshow navigation methods
Listing 13.35. The pause method
Listing 13.36. The addFeed method
Listing 13.37. The fadeIn()/fadeOut() method pair
Listing 13.38. The fadeTo() method
Listing 13.39. The getLayer() method
Listing 13.40. The loadRSSFeed method
3.15.206.105