我有一個控制器函數,以前有整數作爲URL中的每個部分(我在路由文件中設置),但現在其中一個參數需要是一個整數數組。這裏是控制器動作:在asp.net mvc中,我如何傳遞一個整數數組作爲參數
public JsonResult Refresh(string scope, int[] scopeId)
{
return RefreshMe(scope, scopeId);
}
在我的JavaScript
,我有以下的,但我現在需要得到scopeId是一個整數數組。 我怎樣才能設置一個URL張貼到使用jquery,JavaScript的
var scope = "Test";
var scopeId = 3;
// SCOPEID now needs to be an array of integers
$.post('/Calendar/Refresh/' + scope + '/' + scopeId, function (data) {
$(replacementHTML).html(data);
$(blockSection).unblock();
}
我不不要認爲'[]'中的'[]'是必需的。 – Omar 2011-04-26 03:49:09
@Omar這是jQuery網站上的例子。只是一個剪切/粘貼工作。 http://api.jquery.com/jQuery.post/ – 2011-04-26 03:52:15
@Omar:你是對的,這不是必需的。 – 2011-04-26 04:45:42