Coppermill
Coppermill

Reputation: 6794

MVC ActionResult and QueryString

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?

Upvotes: 2

Views: 946

Answers (1)

Daniel Elliott
Daniel Elliott

Reputation: 22857

url: "/ToBePaid/Receipt/" + $(this).attr('value') + "/?receipt=" + $(this).attr('checked')

Should do the trick,

Kindness,

Dan

Upvotes: 4

Related Questions