Working on a J2EE application with the framework
JSP -> ControllerServlet -> EJB Driver -> Bussiness Objects -> and the round trip back to JSP.
1. Calling an AJAX call on a button click,
2. JSP has a div id name "Results" which will be displayed as a POPUP after the ajax call.
3. The EJB process does some DB query and has the results in a Java Object with get/set methods put in the request attribute.
4. I want to populate the resuts div with the data from the above mention java object which is available in the request scope.
I'm not sure what your question is, because you didn't ask one, but here are some observations:
Why aren't you using the .load() method rather than $.ajax()? Always use the simplest tool that does what you need.
The selector '.result' will not match an element with the id of result. What will it match?
Why the absolute URL for the request? Bad idea. Use a server-relative address that starts with the context path.
And please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
I've gone ahead and added the code tags for you. See how much easier the code is to read?
1. I did not use load, because after ajax call, I want only the particular div to have the updated data, and this div is displayed as a modal popup.
2. In my actual code I have used the contextPath, just for the forum I pasted the absolute URL.
3. My question is I want to populate the results div (which is just an empty div as part of the JSP) with the data returned by the server which is available in the request scope.