I recently encountered
one issue that URL.Action returns & in URL,
Basically URL.Action method,
which is used to resolve the qualified URL on based on Controller, Action Name
with Route variable data, returns the qualified URL
Here is source
code
HTML View:
<script type="text/javascript">
$.OrderDetailsURL = '@Url.Action("OrderDetails", "Order", new {
orderID =OrderID, Status =Updated })';
</script>
When you see javaScript
variable OrderDetailsURL value which have
& ; in place of &
and we are
expecting @Url.Action method should return below URL
without & ;
There are two ways
to overcome this issue.
$.OrderDetailsURL = '@Html.Raw(@Url.Action("OrderDetails", "Order", new {
orderID =OrderID, Status =Updated }))';
document.location.href =
$. OrderDetailsURL.replace("&","&");
No comments:
Post a Comment