我正在调用jquery的控制器,我正试图给它一个参数。我没有运气。如果网址只是/SurveySection/EditLocalization
,那么它在没有参数的情况下工作正常/SurveySection/EditLocalization?surveySectionId=3?localizationId=dfasdfas
jquery的
LinkAjax.ajaxRequest("/SurveySection/EditLocalization" += "?surveySectionId=" + "3" + "?languageId=" + $localizationList.val(),
"random data",
"localizationPartial",
null,
null,
localizationSelectList.renderLocalizationPartialView);
这就是我的控制器的样子
public PartialViewResult EditLocalization(int surveySectionId, string languageId)
{
... ajax call fails because I can't pass in parameters correctly
}
答案 0 :(得分:1)
也许控制器的url是错误的。在基本URL之后,查询字符串参数除以?
,参数除以&
。试试这个:
LinkAjax.ajaxRequest("/SurveySection/EditLocalization" += "?surveySectionId=" + "3" + "&languageId=" + $localizationList.val(),
"random data",
"localizationPartial",
null,
null,
localizationSelectList.renderLocalizationPartialView);