AJAX error messages

Hi, a Rails newbie here.

I have an AJAX form which, upon submission, updates another part of the page using AJAX (with an .rjs). I would like to catch illegal submissions and display their corresponding error messages using AJAX. However, I am having trouble retrieving the error messages as they seem to be cleared at some stage - is there any way of passing them through, in params possibly? I would rather do my validations with Rails than JavaScript (which has been suggested elsewhere).

Any help would be much appreciated.

Never mind, I was being stupid.