AlexVPdev2019-04-24 08:19:24
AlexVPdev, 2019-04-24 08:19:24

500 error when connecting ajax php file?

I want to hide a piece of the page from search engines through ajax.
I include .php file

            url: "/some.php",
            type: "post",
            dataType: "json",
            data: {
                "btn":   btn,
                "back":   back,
                "title":   title,
                "cell":  cell
            success: function(data){
                    console.log( "Прибыли данные: " + data.result );

in the some.php file itself, a piece of the page is assembled.
as I understand it, the error is thrown on the lines related to the functions of the WordPress itself

how can i fix this error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Pychev Anatoly, 2019-04-24

Add a line to the beginning of the file and it should work . If you want to figure it out, you can read it here and look inside the file "/wp-admin/admin-ajax.php"

Lander, 2019-04-24

Does some.php file work directly and not via wordpress? If so, then the WP functions are not connected and, accordingly, when you try to find them, everything falls. Fix: Either serve the content you want using WP, or go on a long journey of building all the include files to include them in the script itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question