Assign a Javascript function to AjaxOptions OnSuccess property raise an error - ASP.NET MVC

前端 未结 3 2014
独厮守ぢ
独厮守ぢ 2021-01-11 18:28

I\'m using the Ajax.ActionLink helper to generate a link to delete a record. This is the code:

Ajax.ActionLink(\"Delete Image\", \"DeleteImage\", new { id =          


        
相关标签:
3条回答
  • 2021-01-11 19:05

    To pass a parameter, an anonymous function won't work, you need to do something like this:

    OnSuccess = String.Format("Test({0})", param)
    
    0 讨论(0)
  • 2021-01-11 19:19

    If you have to pass any parameter to the OnSuccess event you may have to write the funcion in this way.

    OnSuccess = "function(){exampleFunction('" + param1 + "');}"
    
    0 讨论(0)
  • 2021-01-11 19:25
    OnSuccess = "Test()" 
    

    you have to write it like this it is a callback...

    OnSuccess = "Test"
    
    0 讨论(0)
提交回复
热议问题