How do I get the source element in the AjaxOptions OnComplete function with MVC Ajax.BeginForm

As the title, I need something along the lines of...

using (Ajax.BeginForm("MyAction",
                        new AjaxOptions {
                            OnComplete = "function() { mySucessFunction(this); }"
                        }))


<script>
    function mySucessFunction(srcElem) {
        alert(srcElem.id);
    }
</script>

Any pointers? Thanks.

Answers


    <% using (Ajax.BeginForm("Create", 
                       new AjaxOptions { OnFailure = "Ajaxerror",
                                         OnBegin="helper_xmlRequestFormControl" ,
                                         OnComplete = "helper_xmlRequestFormSaveEnd", 
                                         UpdateTargetId = "form_customer_create" 
                                        }))       
       { .........   %> 


   <script >
    function helper_xmlRequestFormSaveEnd(obj) {

        //obj.get_data() => server response data 
        //obj.get_request() => ajax object
        //obj.get_loadingElement()=> loading elementId 
        //obj.get_updateTarget()=>updateTarget
        //obj.get_response() => Sys.Mvc.AjaxContext

    }
  </script>

Need Your Help

How do I effectively store a connection string in machine.config only?

asp.net sql-server visual-studio connection-string machine.config

We are moving to an environment with multiple engines of SQL Server running on the same server (a test engine and a production engine). We also have separate test and production web servers, and w...

Spring/hibernate configuration error

java spring hibernate spring-mvc glassfish

I'm new at Java Spring and Hibernate and I'm trying to build an application with those technologies (Maven, Spring and Hibernate). When I try to run it I receive an error from the glassfish server,...