Timsen
Timsen

Reputation: 4126

jQuery Ajax on success is VERY slow

I have a list with 1000 test items, each Item contains 8 propetys. I have a problem with loading time.

When i load the page i run GetListOfTestItems(). The time it takes before it hit return in getTestItems() is under 0.56 seconds. Loading time of whole page is 10.78 seconds. Tested in different browsers with same result After ajax hit success it loads right away, so i think extra 10 secnds comes from, when server send result back to ajax. How to imporove loading time?

    [WebMethod]
    public static List<TestItem> getTestItems()
    {
        List<TestItem> list = service.getTestItems();

        return list;
    }




function GetListOfTestItems() {
    $.ajax({
        type: "POST",
        url: 'UserProfile.aspx/getTestItems',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        error: OnAjaxError,
        success: addAnsweredQuestions

    });

}

}

Upvotes: 0

Views: 1650

Answers (1)

Karl Rosaen
Karl Rosaen

Reputation: 4644

How long does it take until the addAnsweredQuestions is first called? it could be the ajax call is a red herring and something else on the page is slowing things down.

Upvotes: 1

Related Questions