asp.net mvc making ajax call jason
Posted
by mazhar kaunain baig
on Stack Overflow
See other posts from Stack Overflow
or by mazhar kaunain baig
Published on 2010-05-31T11:03:08Z
Indexed on
2010/05/31
12:02 UTC
Read the original article
Hit count: 812
Controller:
public ActionResult EditOrganizationMeta(int id)
{
}
[HttpPost]
[ValidateInput(false)]
public ActionResult EditOrganizationMeta(FormCollection collection)
{
}
View:
function DoAjaxCall() {
var url = '<%= Url.Action("EditOrganizationMeta", "Organization") %>';
//url = url + '/' + dd;
$.post(url, null, function(data) {
alert(data);
});
}
<input type="button" name="something" value="Save" onclick="DoAjaxCall()" />
how would i make the ajax call , i have basically two functions with the same name EditOrganizationMeta,Do the form collection will be passed automatically.Basic confusion is regarding the method call
Ok i made a call by ajax but after that My This code is not running anymore
[HttpPost]
[ValidateInput(false)]
public ActionResult EditOrganizationMeta(FormCollection collection)
{
int OrganizationId = 11;
string OrganizationName = "Ministry of Interior";
try
{
string ids = Request.Params // **getting error here some sequence is not there**
.Cast<string>()
.Where(p => p.StartsWith("button"))
.Select(p => p.Substring("button".Length))
.First();
String RealValueOfThatControl = collection[ids];
}
}
catch { }
return RedirectToAction("EditOrganizationMeta", new { id = OrganizationId });
}
I think that there is no post
© Stack Overflow or respective owner