Dynamic Forms and AntiForgeryToken MVC
- by oliver
Hi ALL,
I want to create dynamic forms on a MVC page that will generate something like this.
onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', '6I6td2wJRI9Nu5Au/F3EfOQhxJbEMXabuVXM0nXonkY='); f.appendChild(s);f.submit();return false;"
I am just not sure how I can implement the AntiForgeryToken on something like above?!?
any helpwould be appreciated