I am trying to grab just a single value from some json and am using Chrome's javascript console to try and debug it. I have tried Request["id"], and Request.Params["id"] and it doesn't grab anything. I have verified via the chrome javascript debugger that the value is going across but I can't pull the value out using webmatrix. Can anybody please help?
code from Default.cshtml
$.ajax({
type: 'POST',
data: encodedItemId, //looks like { id : value }
dataType: 'json',
url: '/actions/act_markCompleted.cshtml',
success: function(data){
alert(data); //trying to view the json data
}
});
Posts via ajax to this page, act_markCompleted.cshtml
@{
var itemId = Request["id"];
var data = "The id is: " + itemId;
var db = Database.Open("VacationBuddyDB");
var sql = "UPDATE Items SET completed = @0 WHERE Id = @1";
db.Execute(sql, true, itemId.AsInt());
Json.Write(data, Response.Output);
}