jonsnow
posted this
16 April 2020
By looking at your Javascript file (nicepage.js) I now understand the problem:
this (8 year old script) is preventing every kind of submit by using jQuery:
- preventDefault
- stopPropagation
then serializing the form and trying to send the data with Ajax.
8 Years ago CORS policy wasn't an issue, but in the meanwhile all browsers follow it and it's not a good practice anymore to submit form data to a foreign server (where you cannot control the headers!) by sending them by Ajax and not by submitting the form.
Of course this can also be done by jQuery Ajax, but the big advantage of using jQuery submit is, that you won't have CORS issues with that, because for the server it's not an automated request, but a human sent form.
However the problem (that nicepage.js is controlling all forms) can be bypassed by renaming the form and inputs, I and creating the form completely without the nicepage-desing, I guess?
Or do I have to edit nicepage.js myself? Maybe this would be a good idea, because I could update it to work with jQuery 3.5 at the same time.
**By looking at your Javascript file (nicepage.js) I now understand the problem:**
this (8 year old script) is preventing every kind of submit by using jQuery:
1. preventDefault
2. stopPropagation
then serializing the form and trying to send the data with Ajax.
8 Years ago CORS policy wasn't an issue, but in the meanwhile all browsers follow it and it's not a good practice anymore to submit form data to a foreign server (where you cannot control the headers!) by sending them by Ajax and not by submitting the form.
Of course this can also be done by jQuery Ajax, but the big advantage of using jQuery submit is, that you won't have CORS issues with that, because for the server it's not an automated request, but a human sent form.
However the problem (that nicepage.js is controlling all forms) can be bypassed by renaming the form and inputs, I and creating the form completely without the nicepage-desing, I guess?
Or do I have to edit nicepage.js myself? Maybe this would be a good idea, because I could update it to work with jQuery 3.5 at the same time.
Last edited 16 April 2020 by jonsnow