gsp中js为
$.post("modifyRight", //用../..路径不正确 {"repoName":repoName}, function(data,state){ alert("state="+state) alert(data.result.repoRight); },"json");
或者
$.ajax({ url: 'modifyRight', data: { repoName: repoName }, success: function(data, status, xhr) { var responseJson = data; typeAheadSource = responseJson.result.repositories; }, error: function(xhr, status, error) { } });
后台为:
def modifyRight(){ String repoName = params['repoName'] render(contentType: "text/json") { result(repoRight:"后台测试") }