In web development, sending data back and forth between the server is a common occurrence. When using jQuery, sending the data is pretty straightforward, however receiving information back from the server is not so simple. You could receive data in different formats (ie. JOSN or HTML), the user may have lost authentication and are no longer permitted to access the page or you may want to send back different information depending on whether or not the task was successful. Over the years, I’ve developed a system for handling these situations that utilizes jQuery and JSON. It’s something that I roll out enough that even if noone finds this post, it’ll help me to have the basic code posted where I can easily access it. So, I’ve decided to document it here.
You can find the code after the break:
Read the rest of this entry »