- Nov 11, 2005
Making the Request
Now that your request object has been created, you're ready to make a request to the server. Create a reference for an event handler to listen for onreadystatechange. The event handler method will then react when the state changes. We'll write this method as soon as we finish writing the request. Open the connection to GET or POST a custom URL, which in this case is the content.xml, and set a Boolean defining whether you want the call to be asynchronous.
It's time to send the request. In the example, I use null because we're using GET; to use POST, you would send a query string with this method:
request.onreadystatechange = onResponse; request.open("GET". url, true); request.send(null);