jquery - AJAX only works one time -


i did modal login form , submit through post ajax request. can login 1 time, when logout , try login again error message of ajax request (csrf failed):

prohibido (403) verificación csrf fallida. solicitud abortada 

the login works again if refresh whole page pressing f5. after success on login refresh header, not whole page. refresh code this:

$('#update-' + idtoupdate).load(' #' + idtoupdate); 

edit: i discovered csrf token works 1 time after success request. have generate new token form work again, , token update if refresh whole page pressing f5, , not want do.

any solution problem? not ajax requests update csrf token, not secure.

i found solution. insert ids of forms csrf token in function $('#update-' + idtoupdate).load(' #' + idtoupdate); after success request. partial async f5 refresh of forms, csrf tokens update , can new requests.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -