Magazine
 
Quick Review:Ajax
 
Five common Ajax patterns
 

When I load this code in my browser, I see the result shown in Figure 7.

Figure 7. The two-segment display updated with data from the server

In the page code, I could have used the XML response, as the material returned from the server is valid XML. But it was easier to use regular expressions instead to crack the individual segments from the XML code.

Conclusion

Ajax is as powerful as it is misunderstood and misused. The patterns I’ve shown in this article provide a good jumping-off point for using Ajax in your Web application. But in addition to using the code provided here, I recommend having a look at some of the great Ajax and Web UI libraries that have come along with the Web 2.0 revolution. Chief among these is the Prototype.js library, which provides easy methods to get data to and from the server as well as cross-browser-compliant methods to update Web page content. The value of using these libraries is that dedicated engineers maintain and test them on a wide variety of browsers and platforms, which can save you a lot of
work and headache.

Either way you cut it, Ajax as demonstrated by the patterns in this article is something you should check into to add dynamic behavior to your applications.

Apr 2008 | Java Jazz Up | 74
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78,   Download PDF