Ajax.BeginForm, Calls Action, Returns JSON, How do I access JSON object in my OnSuccess JS Function?

前端 未结 4 1661
孤街浪徒
孤街浪徒 2020-12-24 03:23

Ajax.BeginForm calls an action and then returns JSON. How do I access JSON object in my OnComplete js function?

so my Ajax.BeginForm<

4条回答
  •  太阳男子
    2020-12-24 03:44

    function OnSuccess(e) { //function CouponSubmitted(data) in the question
       var json = e.get_response().get_object();
       alert(json.success);
    }
    

    This is what the AJAX.BeginForm OnSuccess callback expects you to do to get your JSON back.

    Hope I saved someone else some time on this ridiculously under documented "feature?".

提交回复
热议问题