
Untitled
By: a guest on
May 10th, 2012 | syntax:
None | size: 0.93 KB | hits: 16 | expires: Never
jQuery ajax POST to ASP.NET WebMatrix action
$.ajax({
url: '/File/Location',
type: 'POST',
data: 'username=email@you.com&password=secret',
success: function (data){
console.log(data);
},
error: function (xhr, status, error){
console.warn(error);
}
});
Request = @Request.Form
if(IsPost){
//Aunthentication logic
}
var password = Request["password"];
var username = Request["username"];
if(IsPost){
//Do your thing
}
var password = Request.Form["password"];
public class UserFormInformation{
public string Username{ get; set; }
public string Password { get; set; }
}
[HttpPost]
public ActionResult Login(UserFormInformation info)
{
//...
}
$.ajax({
url: '/File/Location/Login',
type: 'POST',
data: 'username=email@you.com&password=secret',
success: function (data){
console.log(data);
},
error: function (xhr, status, error){
console.warn(error);
}
});