I'm trying to a build a url in asp.net mvc but the object route values data come in later on through ajax. Basically what's happening is the following:
I click a button, which does an ajax call to the server to do some work. If the call is successful, I have to redirect to another page. I tried doing a redirect to action in the method but realized that won't work because it was ajax. So I decided to add the following in the success parameter to my ajax call:
window.location.href = '@Url.Action("view", "controller", new { data=data })';
but obviously this is compiled (or built or whatever) into a string when the page initially renders, and my data=data part is where the data is coming in after the ajax call.
is there another way to incorporate the data into my url?