0

I want to show a popup when user clicks EDIT link.I have written the code mentioned below. Link:-

<a href=javascript:MyFunc('${someVariable}');>EDIT</a>

javascript:-

<script type="text/javascript">
function MyFunc(somevariable){
<c:set var="someVariable" **value="123"**/>    
var answer=confirm("do you want to edit")
if(answer)
window.location="<c:url value='/edit/${someVariable}'/>";
}

When I use some user defined value,it works but I am unable to pass the value of variable from the Link.

TECH WORLD
  • 1
  • 1
  • 3

1 Answers1

1

Instead of MyFunc('${someVariable}') in the anchor tag, I would try:

MyFunc('<c:out value='${someVariable}'/>')

Also, you probably will want to factor out the ${someVariable} from the window.location:

window.location="<c:url value='/edit'/>" + "/" + someVariable
Glen Mazza
  • 748
  • 1
  • 6
  • 27