0
我試圖調用從jQuery的控制器中的一個服務器端的操作調用服務器端方法:單軌 - 如何從jQuery的
$.ajax({
url:'http://localhost:88/admin/business/11/GetChildBusinessTypes',
data: { parentId: $('#business_parentbusinesstype_id').val() },
dataType: 'json',
success: fillChildBusinessTypes,
error: ajaxError
});
這裏是控制器動作:
public string GetChildBusinessTypes(int parentId)
{
//get child business types.
var businessTypes = BusinessTypeRepository.GetChildBusinessTypes(parentId);
//convert to JSON.
var serializer = new JavaScriptSerializer();
return serializer.Serialize(businessTypes);
}
它給了我這個錯誤:
MonoRail無法解析模板'admin \ business \ GetChildBusinessTypes'的視圖引擎實例有兩種可能的原因:模板不存在,或處理特定文件擴展名的視圖引擎尚未正確配置web.config(節單軌,節點viewEngines)。
很明顯,它試圖將操作看作是查看和錯誤輸出。我嘗試將它作爲POST發送而不是GET,但收到相同的錯誤。我需要做些什麼來實現這個目標?
謝謝! 賈斯汀