次のJavascriptを作成しましたが、「無効なJSONプリミティブ:strSeason」というエラーが発生します。残りの構文は問題ないようですが、「data」パラメーターを正しく取得できないようです。誰かが構文を手伝ってくれますか?
TagBuilder script = new TagBuilder("script");
script.Attributes.Add("type", "text/javascript");
script.Attributes.Add("language", "javascript");
// ReSharper disable LocalizableElement
script.InnerHtml = @"
$.ajax({
type: 'POST',
async: true,
contentType: 'application/json; charset=utf-8',
dataType: 'html',
url: '/en-US/" + areaName + '/' + controllerName + '/' + actionName + @"',
data: " + "{strSeason:'" + season + "', strTeam:'" + team + @"'},
beforeSend: function(xhr){
$(this).addClass('ajaxRefreshing');
xhr.setRequestHeader('X-Client', 'jQuery');
},
success: function(html){
$(this).html(html);
},
complete: function(){
$(this).removeClass('ajaxRefreshing');
}
});
";