Search code examples
javascripthtmlbuttonstruts-1

automatically click anchor tag link on jsp page


I am having one tricky requirement. I am explaning through example

abc.jsp calls xyj.jsp and xyj has a link like <a href="viewDetails.do">Click</a>

My requirement is that when i run abc.jsp it calls to xyz.jsp and without showing xyz.jsp page it should call to struts action. It means i want to call to href of anchor tag internally.

Either link or buttun should be clicked internally through javascript so that it will call to struts action dynamically instead of go and click on link manually

Thanks,


Solution

  • My Friend You should use Jquery Method $('a[href="viewDetails.do"]').trigger('click'); It will do auto click. Thanks and let me know if you face any problem using this. Thanks