Call a upload method from a class through AJAX and JQuery RRS feed

  • Question

  • Hey guys!

    I'm trying to develop a tool using html, Jquery and ajax.

    I'm in trouble because i don't know how I call a method from a class.

    And else, i don't know how I'll build it up. 

    In my HTML Code I have

    <input type="file" id="fileupload" /><br />
    <input type="button" value="Upload" id="btnUpload" /> 

    I need create a JQuery Function to call a method from a class.

    In my Class i got

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;

    namespace Project
        public partial class InsertPlanilha : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)

            public static void Uploader()

    I got some questions.

    First, if it's possible to do.

    Second, How can I get parameters to method

    And third, How can I run the method using Ajax and JQuery.

    Thanks in advance

    Friday, November 8, 2013 6:57 PM


  • You should ask this in Asp.Net forums.

    I've seen things here and there about calling server side methods from javascript, but I never pay them much attention. The idea is you make an XHR request to an endpoint (web service, web handler.. anything that can accept requests and send responses).

    So I would suggest you do not try to call a server side method, just send a POST request to a service. It can be an .aspx page but an .ashx handler or web api would be more appropriate.

    For sending ajax (XHR) requests with JQuery see the documentation: http://api.jquery.com/jQuery.ajax/

    Bob - www.crowcoder.com

    Friday, November 8, 2013 8:35 PM