HI, I have an EAR project built with Spring MVC 3.1.
I use jquery .ajax to submit a POST when uploading a photo.
When the photo is uploaded successfully for the first time, I deleted it via ajax call, then adding another photo with the ajax POST call for uploading another photo. But this time when I click the upload button, the ajax POST doesn't return with Success or Error.
First let's clean up the code. You're using jQuery, obviously, so why are you doing everything the hard way?
Rather than gathering up all the form elements "by hand", why aren't you just using jQuery's .serialize() method? In fact, you could be using the Forms plugin to make this even easier.
Then, get rid of the onclick attribute on the button, and establish the event hander using the .on() method; preferably establishing a submit handler on the form rather than a click handler for the button.
With the code cleaned up, open the debugging console in your browser (I like Chrome's dev tools a lot) and see what's actually going on. Is the second request even being made? If so, what's the response?