If I need to call some action method of a controller from within javascript code I can call it just passing the href, right? Something like that:
$.colorbox({ href: '/Calendar/SessionPropertiesEditbox?starts='+start+' })
That’s not gonna work. The problem is the exact link should include the domain name also.
But you don’t know what the domain name would be. It could be “http://localhost:7741” today, tomorrow could be absolutely different.
So how to emulate ActionLink behavior in javascript code?
You are incorrect; that will work.
It’s a domain-relative path, so the browser will automatically add the current domain.
If your application is not running in the domain root, it will not work, since it will look in the domain root.
If so, you’ll need to call
Url.Actionand pass its result to your Javascript.In a Razor view, that would look like