2009-04-10 63 views

回答

4

在你的控制器动作,使用内置JSON中的方法:

return Json(new {name1 = "value1", name2 = "value2"}); 

而且你的jQuery的电话:

$.ajax({ 
    type: "POST", 
    url: "/your-url", 
    dataType: "json", 
    data: {data: to_send}, 
    success: function(msg) { 
     alert(msg.name1); 
     alert(msg.name2); 
    } 
}); 
//you can of course use another ajax function jQuery provides. 
相关问题