C
C
Cheizer2021-02-04 11:57:38
gulp.js
Cheizer, 2021-02-04 11:57:38

Why don't ajax requests work in GULP browsersync?

Why don't ajax requests work in GULP browsersync? There is a simple mail form in the project, ajax is sent, everything is standard and simple

$.ajax({
                                type: "POST",
                                url: '/MailHandler.php',
                                data: {
                                       .....
                                },


All paths are ok in the php file, I checked it a hundred times, but when submitting the form in the console, the error is 404

POST localhost:3009/MailHandler.php 404 (Not Found)

If you run it on an open server which is simple, everything works without problems, but in gulp browsersync doesn't want to.
What to tweak in GULP? Why is this happening, please help! Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Romanov, 2021-02-04
@Cheizer

Because browsersync creates an HTTP server and it doesn't support php files. PHP handler can be installed in Apache but not in GULP browsersync.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question