當前的腳本:將json數據傳遞給URL?
var IrregularChartParams = InitializeChartParams();
// parametreleri json stringe cevir...
var chartParams = JSON.stringify(IrregularChartParams);
$.ajax({
url: '/Widget/GridExportToExcel',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: chartParams,
....
控制器
public void GridExportToExcel(IrregularChartParams chartParams)
{
我想有些事情就像下面:
// I know this does not work...
var url = '/Widget/GridExportToExcel' + chartParams
window.open(url);
什麼是最簡單的方式來增加JSON數據與模型結合網址是什麼?
http://stackoverflow.com/questions/5818065/how-to-pass-request-querystring-to-url-action –
@Ravi,很抱歉我更新了我的問題。我使用剃刀分開的js文件。所以我不能使用「Ur.Action」 –
在我看來,你真的想在查詢字符串中傳遞一些參數。如果你在你的action方法中匹配查詢字符串參數名和參數名,你會得到你想要的。 – Jammer