MVC ActionResult and QueryString
-
21-09-2019 - |
Question
I'm a little puzzled with QueryStrings and ActionResult
I have a URL coming in from jQuery as:
url: "/ToBePaid/Receipt/" + $(this).attr('value') + "&receipt=" + $(this).attr('checked')
which generates
/ToBePaid/Receipt/28cb8260-d179-450f-b9c4-162f1cc45bbd&receipt=true
and my ActionResult is as follows:
public ActionResult ReceiptExpenseForGrouping(string id, string receipt)
and what I am getting is
id = "28cb8260-d179-450f-b9c4-162f1cc45bbd&receipt=true" receipt = "true" = null
But what I want is
id = "28cb8260-d179-450f-b9c4-162f1cc45bbd" receipt = "true"
Please help me out here someone?
Solution
url: "/ToBePaid/Receipt/" + $(this).attr('value') + "/?receipt=" + $(this).attr('checked')
Should do the trick,
Kindness,
Dan
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow