I am passing parameters to @Url.Action like this:
function showHistory()
{
myId= $("#id").val();
//alert(myId);
actionDialog.load("@Url.Action("ActionHistoryAjax", new {id = myId, sort = "abc"})", function () {
actionDialog.dialog('open');
});
}
But gives error "the name myId does not exist in the current context".
How i can pass the variable?
I solved this, this is the solution:
function showHistory()
{
myId= $("#id").val();
//alert(myId);
actionDialog.load("@Url.Action("ActionHistoryAjax", new {id = "_Id", sort = "abc"})".replace("_Id", DeviceID), function () {
actionDialog.dialog('open');
});
}
Syntax: var URLSearchParams = URL. searchParams; Example 1: This example adds the parameter by using append method.
How do you pass dynamic values in URL action? You can concat the client-side variables with the server-side url generated by this method, which is a string on the output. Try something like this: var firstname = "abc"; var username = "abcd"; location. href = '@Url.
I solved it by using this:
function showHistory()
{
myId= $("#id").val();
actionDialog.load("@Url.Action("ActionHistoryAjax", new {id = "_Id", sort = "abc"})".replace("_Id", DeviceID), function () {
actionDialog.dialog('open');
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With