First, I'm using jquery $.ajax. I'm wondering how to send ajax request to servlet every page load, and receive object (not json text) from servlet. what's the code in the servlet side and what's inside the success callback?
I need ajax to avoid page refresh. after some thoughts, it wouldn't make sense to place ajax call every page refresh. you got a point. But I just want to clarify, it's impossible to send object via ajax? absolutely impossible? text only? if so, does java have built-in lib to convert object to json?
There's no page refresh involved with pre-formating the page with JSP (or whatever you are using on the server).
After the page has been loaded, Ajax is used to avoid page reloads after user clicks and so on. But on page load, it's usually better to take of formatting the page on the server before it's sent to the client in the first place.
Joined: Jan 31, 2011
and how about the json lib? java has built-in? or must use third party? if third party, what's your recommendation? thanks