Using JSON and Ajax together
I 开发者_开发技巧have never used Ajax with JSON. Are there any good resources to look upon?
Think of Ajax as a way to send and receive textual content with the server. The format of the messages you send back and forth is up to you. You could use JSON, XML, YAML, CSV, or whatever else you want.
If you separate these two concerns your problem should be a lot easier to approach.
- Figure out how to make an Ajax call to your server
- Figure out how to parse and serialize JSON
If you use a JavaScript framework, like jQuery or Prototype, both of these things will be handled for you pretty seamlessly with their Ajax APIs.
- http://api.jquery.com/jQuery.ajax/
- http://www.prototypejs.org/api/ajax/request
精彩评论