Monday, September 26, 2022
HomeWordPress Developmentajax - how cut back fetch/XHR response time

ajax – how cut back fetch/XHR response time


i utilizing this code for ajax requset

entrance code:

perform ajax_request() {
        jQuery(doc).prepared(perform () {
            $.ajax({
                url: ajaxurl,
                kind: 'POST',
                information: {
                    'motion': 'myFunction',
                    'information' : 'information'
                },
                success: perform (information) {
                    ...
                },
                error: perform (error) {
                    ...
                }
            })
        })

    }

backend code :

perform myFunction()
{
        if (isset($_POST)) {
            // do one thing
            wp_send_json(true);
        }
}

add_action('wp_ajax_myFunction', 'myFunction');

for backend I added codes to capabilities.php file which have about 2000 traces of code

downside is common response time is about 4 5 second which truly lengthy
once I clear these additional line of code and preserve simply code associated to ajax the entire cycle of ajax course of shall be about 300 or 400 milliseconds …
how I can cut back that point whereas preserve that 2000 traces of code ?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments