简体   繁体   English

从javascript创建grails视图的链接

[英]creating link for grails view from javascript

I have a table with one column redirecting to another page. 我有一个表,其中一列重定向到另一页。 But table changes dynamically so I need to create the link in javascript function. 但是表是动态变化的,因此我需要在javascript函数中创建链接。

I am trying to create link a href="" which call another view with parameters. 我正在尝试创建链接href =“”,该链接使用参数调用另一个视图。 I need below createrlink into my href but when I insert it ..it just ignoring the parameter part 我需要下面的createrlink到我的href中,但是当我将它插入..it时,它只是忽略了参数部分



 linkpage = '${createLink(action:'showGraph')}?inputprscode='+ phenocatsel+'&inprscat='+phenocatsel+'&inprsstudy='+phenomesel;


linkpage =  '<a class="intro"  href="<g:createLink action="showGraph" params="${[inputprscode:phecode, inprscat: prssrc ,inprsstudy:phenomes]}"/>">link</a></li>';```

Basically I created url as string and then just inserted into the a href to solve the quote problem 基本上,我将url创建为字符串,然后将其插入到href中以解决引用问题

linkpagedr = '${createLink(action:'showGraph')}?inputprscode='+ phenocatsel+'&inprscat='+phenocatsel+'&inprsstudy='+phenomesel; linkpage ='<a class="intro" href="'+linkpagedr +'">link</a>';

But I m not sure if this is an efficient way. 但是我不确定这是否是一种有效的方法。 If anybody knows a better way to implement this , please let me know. 如果有人知道实现此目的的更好方法,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM