Click here to Skip to main content
15,746,107 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
function viewvideo(videoid) 
    varVideoid = videoid;
    var data = Ajax("../Ajax/Webmethod.aspx/getviewvideo", { videoid: videoid });
function Ajax(url, _data) {
    var obj;
        type: "post",
        url: url,
        data: JSON.stringify(_data),
        async: false,
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        success: function (data) {
            obj = $.parseJSON(data.d);
        error: function (xhr, status, error) {
            alert("Some Error");
    return obj;
    public static string getviewvideo(string videoid)
        databasesss db = new databasesss();
        JavaScriptSerializer js = new JavaScriptSerializer();
        return js.Serialize(v);

Hi , When ajax call Webmethod, there is speed issue.
What is wrong with my code or what should I check?
Any comment would be helpful
Thank you

What I have tried:

I have tried to use <asp:hiddenfield> but there are many things to edit so I am looking for another way
Updated 27-Mar-17 5:56am

1 solution

First you need to explain what you are attempting to do in detail. A code dump saying this is slow is meaningless to anyone on this board. We cannot see your monitor or read your mind to figure out what you are doing.

If I had to guess are you trying to load a video via your Ajax call. If it slow what is the size of the video?
Share this answer
hapiten 27-Mar-17 20:52pm    
Thank you for your helo.
I have traced the excution time using vs 2015. It takes 1200ms while ajax call webmethod in c#.
That's what I asked thank you
AnvilRanger 28-Mar-17 8:10am    
You need to provide details about what you are attempting to do? We cannot access your system nor can we attempt to debug your application. You have not provide the complete and relevant code for you call. You are missing almost of the webmethod.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900