开发者

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

As the title, I need somethi开发者_C百科ng 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.


    <% 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜