1

MVCコントローラーからJsonとして返されるオブジェクトのリストがあります。このオブジェクトをビューに表示する方法を考えています。

function GetTabData(xdata) {
    $.ajax({
        url: ('/Home/GetTabData'),
        type: 'POST',
        contentType: 'application/json',
        data: JSON.stringify({ id: xdata }),

        success: function (result) {
           /// what to do here? 
        },
        error: function () { alert("error"); }
    });
}

public JsonResult()
{
   ...
   var temp = getMyData...
   return Json(temp, JsonRequestBehavior.AllowGet);   
}

ページを見る

<div id="showContent"> </div>
4

1 に答える 1

1

これがあなたがしなければならない最初のステップです:

success: function (result) {
    /// what to do here? 
    result = jQuery.parseJSON(result);
    /// Exploit your object(s) ;)
},

エクスプロイトの詳細については、こちらをご覧ください: http://api.jquery.com/jQuery.parseJSON/

于 2012-07-19T20:32:39.780 に答える