You are previewing Pro PHP Programming.

Pro PHP Programming

Cover of Pro PHP Programming by Brian Danchilla... Published by Apress
  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Foreword
  8. Acknowledgments
  9. Introducing PHP
    1. Origins of PHP
    2. What Is PHP?
    3. High- Level Overview of This Book
    4. The Future of PHP
  10. Chapter 1: Object Orientation
    1. Classes
    2. Inheritance and Overloading
    3. Miscellaneous “Magic” Methods
    4. Copying, Cloning, and Comparing Objects
    5. Interfaces, Iterators, and Abstract Classes
    6. Class Scope and Static Members
    7. Summary
  11. Chapter 2: Exceptions and References
    1. Exceptions
    2. References
    3. Summary
  12. Chapter 3: Mobile PHP
    1. Mobile Variance
    2. Detecting Devices
    3. Detecting Mobile Capabilities
    4. Rendering Tools
    5. Emulators and SDKs
    6. QR Codes
    7. Summary
  13. Chapter 4: Social Media
    1. OAuth
    2. Twitter
    3. Facebook
    4. Summary
  14. Chapter 5: Cutting Edge
    1. Namespaces
    2. Anonymous Functions (Closures)
    3. Nowdoc
    4. Local goto Statements
    5. Standard PHP Library
    6. Phar Extension
    7. Summary
  15. Chapter 6: Form Design and Management
    1. Data Validation
    2. Uploading Files / Images
    3. Image Conversion and Thumbnails
    4. Regular Expressions
    5. Multi-Language Integration
    6. Summary
  16. Chapter 7: Database Integration I
    1. Introduction to MongoDB
    2. Introduction to CouchDB
    3. Introduction to SQLite
    4. Summary
  17. Chapter 8: Database Integration II
    1. Introduction to MySQLi Extension
    2. Introduction to PDO
    3. Introduction to ADOdb
    4. Full-Text Searches with Sphinx
    5. Summary
  18. Chapter 9: Database Integration III
    1. Introduction to Oracle RDBMS
    2. The Basics: Connecting and Executing SQL
    3. Array Interface
    4. PL/SQL Procedures and Cursors
    5. Working with LOB types
    6. Connecting to DB Revisited: Connection Pooling
    7. Character Sets in the Database and PHP
    8. Summary
  19. Chapter 10: Libraries
    1. SimplePie
    2. TCPDF
    3. Google Map Integration
    4. E-mail and SMS
    5. gChartPHP: a Google Chart API Wrapper
    6. Summary
  20. Chapter 11: Security
    1. Never Trust Data
    2. Common Attacks
    3. Sessions
    4. Preventing SQL Injection
    5. The Filter Extension
    6. php.ini and Server Settings
    7. Password Algorithms
    8. Summary
  21. Chapter 12: Agile Development with Zend Studio for Eclipse, Bugzilla, Mylyn, and Subversion
    1. Principles of Agile Development
    2. The Agile Development Rally
    3. Introduction to Bugzilla
    4. Mylyn for Eclipse
    5. Bugzilla and Mylyn Combined Within Eclipse
    6. Extrapolating the Benefits
    7. Summary
  22. Chapter 13: Refactoring, Unit Testing, and Continuous Integration
    1. Refactoring
    2. Unit Testing
    3. Continuous Integration
    4. Summary
  23. Chapter 14: XML
    1. XML Primer
    2. Schemas
    3. SimpleXML
    4. DOMDocument
    5. XMLReader and XMLWriter
    6. Summary
  24. Chapter 15: JSON and Ajax
    1. JSON
    2. Ajax
    3. A Simple Graphic Program
    4. Summary
  25. Chapter 16: Conclusion
    1. Resources
    2. Conferences
    3. PHP Certification
    4. Summary
  26. Appendix: Regular Expressions
    1. Regular Expression Syntax
    2. Regular Expression Examples
    3. PHP Regular Expression Functions
  27. Index
O'Reilly logo

C H A P T E R  15

JSON and Ajax

Web pages have evolved over recent years, mimicking the functionality found on desktop applications. Despite the added complexity, the user experience has greatly improved; developed sites feel more responsive and engaging. Through quicker feedback, popup tips, auto-completion, and fewer necessary full-page reloads, browsing is a richer, more intuitive, and enjoyable experience.

What makes this all possible is the technique of issuing asynchronous requests from the browser to the server and receiving back responses. The requests are asynchronous because they are done in separate threads that do not block the main script execution. Information is passed back and forth in the form of JSON (JavaScript Object Notation), ...

The best content for your career. Discover unlimited learning on demand for around $1/day.