javascript - How to Pass QueryString in window.location.href? -


i have written following javascript function

function getval(sel)  {     window.location.href = "posts?category=<%= sel %>";  } 

but value of sel variable not considered in querystring..

instead of it, takes value following.

...../post/posts?category=%3c%=%20sel%20%%3e

can me???

because javascript not understands jsp scriptlet,

try,

window.location.href = "posts?category=" + sel; 

Comments