为什么使用Ajax的查询速度慢?

I made a PHP class for search database with some methods. i.e LIKE, FULL TEXT and ...

I did test it on a huge database. The search speed was great, so I started to use this script in my page.

I decided to use AJAX to speed up stuff...

This is my ajax code :

    $.ajax({
        type: "POST",
        data: publisher + '&blur=true',
        url:"server/advance2.php",
        ifModified: true, /* tested with and without this */
        cache: true, /* tested with and without this */
        statusCode: { 404: function() {

                $('#target').html('<h4 class="col-md-offset-4 col-md-3 textRed textCenter farsi">Error...</h4>');

            }//404
        },//statusCode
        beforeSend: function() {

            $('#target').html('<img src="e995a9c2864f.gif" class="col-md-offset-4 col-md-3" alt="We are searching, please wait"/>');

        },
        success: function(result) {
            $('#target').html(result)
        }

    });//Ajax Request After Blur

but the search speed significantly decreased.

Would you tell me why it's happening, and how I can fix it?

A couple of quick debugging ideas:

1) Open up the browser debugger, usually started with F12, make sure the the majority of the time of the response is waiting on the web server (vs rendering, etc.).

2) On the server side, find the db query log and see how long the query itself is actually taking. As noted in other answers, there are a number of moving parts here. You just need to step by step and find the one that's taking longer than expected.