jquery - I can't get the code working to execute a stored procedure using @Ajax.ActionLink MVC EF -
i have stored procedure built refreshes lookup table. no rows returned. runs.
here ajax link on view fire it:
@ajax.actionlink( "refresh sample points", " makenewspidtable", "home", new ajaxoptions { httpmethod = "post", onsuccess = "success" } )
here is json action result in homecontroller:
[httppost] public jsonresult makenewspidtable() { var bitbucket = _db.executefunction("sp_refreshwsfspids"); homecoming json("sp ran", jsonrequestbehavior.denyget); }
(the "sp ran" text hardcoded send back.)
here success function should pop alert:
function success(responseobject) { alert(responseobject); }
i can stored procedure run in sorts of ways not ajax. uncertainty have ajaz/jason syntax correct.
thank alex, moy, , stackoverflow. , have new tool (to me) troubleshooting mad scientist stuff. firebug in mozilla , shows javascript error happens. funny, ie4 or used have error in bottom frame of window oh well.
this seems work , returns alerts success or failure. changed letter in stored procedure name , "failed" , popped alert. onsuccess , onfailure worked in other words. had alert in them.
@ajax.actionlink( "refresh sample points", "makenewspidtable", "home", new ajaxoptions { httpmethod = "post", onsuccess = "handleresultresponserefreshsamplepoints()", onfailure = "handlefailedspidrefresh()" } )
i can live because need. however, couldn't controller homecoming string success, or don't have syntax knowledge of json homecoming object. hope simple solution helps else.
[httppost] public jsonresult makenewspidtable() { var bitbucket = _db.executefunction("sp_refreshwsfspids"); var name = "json ran stored procedure"; homecoming json(name, jsonrequestbehavior.denyget); }
jquery ajax asp.net-mvc stored-procedures
No comments:
Post a Comment