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

匆匆过客 提交于 2019-12-01 03:17:13
silverfighter
OnSuccess = "Test()" 

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

OnSuccess = "Test"

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 + "');}"

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

OnSuccess = String.Format("Test({0})", param)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!