Invalid form POST data in AJAX Login form I am working on a drupal 7 website using an AJAX login form. I have a problem, the form work fine once and then doesn't work when I logout and try again. I need to empty cache and try again to have it work again. 
I think this is something linked to the form_id not found in cache but I don't know how to fix it.

Any solution?

Thanks
short: 
it should works if you disable "cache pages for anonymous users"

long: 
When Drupal's core caching feature is switched on, forms are delivered to anonymous visitors from cache which results in the situation where one and the same form gets delivered more than once with the same form_build_id.

As soon as one of the anonymous users submits such a form, the record gets removed from cache.

The next visitor who is submitting the same form will potentially run into trouble because of the missing form record in cache.

The regular Drupal FAPI seems to be OK with that but if the form gets submitted via Ajax, the submission gets rejected, a watchdog entry gets issued ('Invalid form POST data') and drupal_exit() gets called.

The result of that is that the user would have to reload the page before being able to submit the form. This can be annoying i.e. if the form being used is the user login form. It seems as if just nothing is happening.

This issue arrises always when page caching for anonymous users and form submission via Drupal's own ajax mechanism get used in combination.

source: 
http://drupal.org/node/1694574