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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -