Now that we have covered basic database interaction with Ajax, we will learn advanced ways of creating database-driven XHRs and their responses. We will cover how to minimize the number of requests to the server by sending bulk data formatted as arrays, XML, or JSON. We will also learn how minimizing the number of requests will speed up our application, help us to create more advanced interactions with the database, and provide us with the beginnings of an API that can be accessible via HTTP in which developers can send requests, pass specific data as parameters, and either receive structured data responses from the web application or store data in the database. The second part of this chapter will cover sending custom responses as XML or JSON. Then there is a brief reminder of how to handle the response on the client side. Let's get started by taking a look at bulk updates. |