Answer the question
In order to leave comments, you need to log in
How can encoding a PHP file cause JavaScript to fail?
There is an html form on the site. There is a JavaScript file that sends the form content to a PHP file. PHP sends the content to the mail. Instead of Russian letters, cracks came to the mail - the point was that I wrote PHP in a notepad, and it had the ANSI form, not UTF-8. Saved in UTF format. Normal Russian letters began to come to the post office. But suddenly the Javascript file stopped working. Usually, when the form was successfully submitted, it notified me that "Message has been sent". I thought it was because he stopped understanding the response of the PHP file due to the encoding change. But then I inserted a verification code before accessing the PHP file via "post". Suddenly, it doesn't work either. That is, JavaScript responds to form submission by sending its data to a PHP file, but refuses to do anything either after or before. At the same time, returning the old version of the PHP file with ANSI encoding to the hosting makes JavaScript work again. On my computer, the check part of the code after pressing the button but before sending the data to the PHP file works because Apache is not enabled and PHP is not processed. Does anyone have any idea what is even going on? For me, it's mystical.
Answer the question
In order to leave comments, you need to log in
Mystique will be destroyed by the Console in the browser.
Press F12, select the console, submit the form - 100% error will crawl out.
First, try to recode the JS file itself into UTF-8. What comes in response from PHP? Perhaps you have checks in the JS file of the incoming response. Have you converted the JS file to UTF-8? Post a part of the code with receiving a response on the JS side and sending a response on the PHP side.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question