Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
[Play.aspx]
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
.....
viewvideo(videoid)
.......
</asp>
[Video.js]
function viewvideo(videoid) 
{
    varVideoid = videoid;
    $("#video").empty();
    var data = Ajax("../Ajax/Webmethod.aspx/getviewvideo", { videoid: videoid });
}
[function.js]
function Ajax(url, _data) {
    var obj;
    $.ajax({
        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;
}
[Webmethod.aspx.cs]
 [WebMethod]
    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
Posted
Updated 27-Mar-17 5:56am
v2

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
 
Comments
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