I'm having difficulty getting the callbacks to work for a form. I have something like this:
<script>
function VendorCreated() {
alert('ok');
}
</script>
@using (Ajax.BeginForm("Create", "Vendor", new AjaxOptions {
UpdateTargetId = ViewBag.TargetId,
HttpMethod = "Post",
OnSuccess="VendorCreated",
})) {
upon submission my function never gets created. If I use:
OnSuccess="alert('ok')"
it works fine. I've also tried:
OnSuccess="function() { VendorCreated(); }"
but I get a runtime error. Others are having this issue but I've found no resolution, see MVC 3 Razor - Ajax.BeginForm OnSuccess and Ajax.BeginForm OnBegin confirmation Via jquery modal.
If I look at the IE debugger (F12) I don't see a script tag in the code generated... what's the right approach?