Ajax & PHP without using the XmlHttpRequest Object

kangqin 2006-03-22 10:47:31
http://www.phpit.net/article/ajax-php-without-xmlhttprequest/
...全文
96 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
supNate 2006-03-22
  • 打赏
  • 举报
回复
好思路!
其实不仅php可用,任何服务器技术均可!
AJAX is a complex phenomenon that means different things to different people. Computer users appreciate that their favorite websites are now friendlier and feel more responsive. Web developers learn new skills that empower them to create sleek web applications with little effort. Indeed, everything sounds good about AJAX! At its roots, AJAX is a mix of technologies that lets you get rid of the evil page reload, which represents the dead time when navigating from one page to another. Eliminating page reloads is just one step away from enabling more complex features into websites, such as real-time data validation, drag-and-drop, and other tasks that weren't traditionally associated with web applications. Although the AJAX ingredients are mature (the XMLHttpRequest object, which is the heart of AJAX, was created by Microsoft in 1999), their new role in the new wave of web trends is very young, and we'll witness a number of changes before these technologies will be properly used to the best benefit of the end users. AJAX isn't, of course, the answer to all the Web's problems, as the current hype around it may suggest. As with any other technology, AJAX can be overused, or used the wrong way. AJAX also comes with problems of its own: you need to fight with browser inconsistencies, AJAX-specific pages don't work on browsers without JavaScript, they can't be easily bookmarked by users, and search engines don't always know how to parse them. Also, not everyone likes AJAX. While some are developing enterprise architectures using JavaScript, others prefer not to use it at all. When the hype is over, most will probably agree that the middle way is the wisest way to go for most scenarios. In AJAX and PHP: Building Modern Web Applications – Second Edition, we take a pragmatic and safe approach by teaching relevant patterns and best practices that we think any web developer will need sooner or later. We teach you how to avoid the common pitfalls, how to write efficient AJAX code, and how to achieve functionality that is easy to integrate into current and future web applications, without requiring you to rebuild the whole solution around AJAX. You'll be able to use the knowledge you learn from this book right away, in your PHP web applications. What this book covers Chapter 1: The World of AJAX and PHP is all about a quick introduction to the world of AJAX. In order to proceed with learning how to build AJAX applications, it's important to understand why and where they are useful. It describes the XMLHttpRequest object, which is the key element that enables the client-side JavaScript code to call a page on the server asynchronously. Chapter 2: JavaScript and the AJAX Client walks you through many fields such as working with HTML, JavaScript, CSS, the DOM, XML, and XMLHttpRequest. It discusses the theory (and practice) that you will need to know to make these components come together smoothly, and form a solid foundation for your future AJAX applications. It also shows you how to implement simple error-handling techniques, and how to write code efficiently. Chapter 3: Object Oriented JavaScript covers a large area of what object-oriented programming means in the world of JavaScript starting from basic features and going far into the execution context of functions. It teaches you the basic OOP concepts—encapsulation, polymorphism, and inheritance, how to work with JavaScript objects, functions, classes, and prototypes, how to simulate private, instance, and static class members in JavaScript, what the JavaScript execution context is, how to implement inheritance by using constructor functions and prototyping, and the basics of JSON. Chapter 4: Using PHP and MySQL on the Server starts putting the server to work, using PHP to generate dynamic output, and MySQL to manipulate and store the backend data. This chapter shows you how to use XML and JSON with PHP (so that you can create server-side code that communicates with your JavaScript client), how to implement error-handling code in your server-side PHP code, and how to work with MySQL databases. Chapter 5: AJAX Form Validation creates a form validation application that implements traditional techniques with added AJAX flavor, thereby making the form more user-friendly, responsive, and pleasing. The intention of this chapter isn't to build the perfect validation technique but, rather, a working proof of concept that takes care of user input and ensures its validity. Chapter 6: Debugging and Profiling AJAX Applications teaches how to enable and use Internet Explorer's debugging capabilities. It shows how you can work with Web Development Helper, Developer Toolbar, and other Internet Explorer tools and with Firefox plugins such as Firebug, Venkman JavaScript Debugger, and Web Developer. This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 Preface [ 3 ] Chapter 7: Advanced Patterns and Techniques briefly covers some of the most important patterns and techniques covering usability, security, and techniques. Looking at methods, patterns, and techniques is so important that it has developed into its own science and has created a set of guidelines for typical problems that offer us predictable results. Chapter 8: AJAX Chat with jQuery teaches how to use AJAX to easily implement an online chat solution. This will also be your opportunity to use one of the most important JavaScript frameworks around—jQuery. More precisely, this chapter will explain the basics of jQuery and show how to create a simple, yet efficient client- server chat mechanism using AJAX. Chapter 9: AJAX Grid explains the usage of an AJAX-enabled data grid plugin, jqGrid. Appendix: Preparing Your Working Environment covers the installation instructions that set up your machine for the exercises in this book. It also covers preparing the database that is used in many examples throughout the book. What you need for this book To go through the examples in this book you need PHP 5, a web server, and a database server. We have tested the code under several environments, but mostly with the Apache 2 web server, and MySQL 4.1 and MySQL 5 databases. You can choose, however, to use another web server, or another database product, in which case the procedures presented in the chapters might not be 100% accurate. It is important to have PHP 5 or newer, because we use some features, such as Object Oriented Programming support, which aren't available in older versions. Please read the appendix for more details about setting up your machine. If your machine already has the required software, you still need to read the final part of appendix, where you are instructed about creating a database that is used for the examples in this book. Who this book is for This book is written for PHP developers who want to learn how to use PHP, JavaScript, MySQL, and jQuery to implement Web 2.0 applications, are looking for a step-by-step, example-driven AJAX tutorial, want to learn advanced AJAX coding patterns and techniques, and want to be able to assess the security and SEO implications of their code.
With the advent of RIAs (Rich Internet Applications), most web pages are driven by a combination of JavaScript, AJAX, CSS, and so on. It is difficult for front end and web developers to debug and fix issues that crop up on client machines. Firebug helps to solve this; it is a wonderful toolkit to help identify and fix issues that would ordinarily take much longer to find and fix. Instant Firebug Starter is a practical, hands-on guide that provides you with a number of clear step-by-step exercises to help you take advantage of the full power that Firebug offers. This book will give you a great grounding in using Firebug to debug, fix, and optimize your web pages. From installation to navigating the various panels to edit, inspect, and modify your webpages, this practical guide will help you through the wilds of Firebug without a single bite. A step-by-step description of key features is provided with the help of simple and concise examples. Each chapter will help you understand the key features of Firebug with tips and tricks that will become the foundation of your knowledge in the future. The Instant Firebug Starter can be used as an end-to-end guide or as a desk reference with sections that deal with all the key aspects of web development like CSS, Javascript, and AJAX. This Instant Firebug Starter guides you through the basics of Firebug and contains years’ worth of industry knowledge and expertise. This knowledge has been stripped back to 60 pages of useful insights, tips, tricks, and the latest techniques that will get you up to speed in no time. What you will learn from this book Get to grips with the basics of Firebug’s panels and their functions. Inspect, edit and play with HTML sources. Discover various ways to analyze the performance of your web application on the browser. Track XmlHttpRequest and XmlHttpResponse as well as monitoring AJAX calls. Explore the value of properties and constants of any DOM object. Monitor, edit, and remove cookies from Firebug. Approach Get to grips with a new technology, understand what it is and what it can do for you, and then get to work with the most important features and tasks. This easy to understand Starter guide will get you up to speed with Firebug quickly and with little effort. Hands-on and practical examples allow you to get a feel for the tool and get used to using it on a day-to-day basis. Who this book is written for If you are just starting out with web development and looking to improve your site with Firebug, then this guide is for you. If you have a basic understanding of web development then this guide is easy to follow and will benefit your site no end.

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧