Razor Car Safety is messing with me. I am building a URL to submit to the jquery $ .load method:
<script> $("#baz").load('@Url.Action("Method", new { foo=Model.Foo, bar=Model.Bar })'); <script>
The problem is that the url comes out escaped in the release of the script (& == &)
<script> $("#baz").load('Method?foo=Foo&bar=Bar'); <script>
So MVC is choking on the request, saying that the bar parameter was not provided.
I tried wrapping the call in @ Html.Raw, but it seems to be hiding the url. Let's go back to the aspx planet, I would just do <% = instead of <%: but obviously thereβs nothing good here :). I also tried putting the parameters in the data object for $ .load, but this seems like a message, not get (and I want to get here).
This is something I could just fix using routing, but this project does not exist yet - functionality still appears without using routing. On the other hand, I need to be able to ultimately redirect this URL, so I donβt want to just re-encode the request.
Any thoughts?
lamont
source share