Asp.net mvc json

Posted by user310657 on Stack Overflow See other posts from Stack Overflow or by user310657
Published on 2010-05-22T11:34:38Z Indexed on 2010/05/22 11:40 UTC
Read the original article Hit count: 621

Hi,

I am working on a mvc project, and having problem with json.

i have created a demo project with list of colors

public JsonResult GetResult()
{
List strList = new List();
strList.Add("white");
strList.Add("blue");
strList.Add("black");
strList.Add("red");
strList.Add("orange");
strList.Add("green");
return this.Json(strList);
}

i am able to get these on my page, but when i try to delete one color, that is when i send the following using jquery

function deleteItem(item) {
$.ajax({
type: "POST",
url: "/Home/Delete/white",
data: "{}",
contentType: "application/json; charset=utf-8",
success: ajaxCallSucceed,
dataType: "json",
failure: ajaxCallFailed
});
}

the controler action

public JsonResult Delete(string Color) {}

Color always returns null, even if i have specified "/Home/Delete/white" in the url.

i know i am doing something wrong or missing something, but not able to find out what.

please can any one guide me in the right direction.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc