Hi everyone I write a simple application and now i want to rewrite my CRUD operations using Jquery/ajax and bootstrap modal forms. Im totally new in jquery and have some problem with editing data. I call Get action and it find and return data but i know how to fill in partial view data fields in Partial View whit this result. Can anyone help?
Index page Edit script:
function Edit(Id) {
if (confirm("Are you really want to change this record?"))
{$.ajax({
type : 'Get' ,
url : '@Url.Action("AddOrEditPartial","ProductCategory")/' + Id ,
datatype: 'json',
success: function (response) {
?????
}
});
}
}Controller
[HttpGet]publicActionResultAddOrEditPartial(stringId){ProductCategory data =newProductCategory();
data = context.Find(Id);returnActionResult(data);}[HttpPost]publicActionResultAddOrEditPartial(ProductCategory pr){bool status =false;if(ModelState.IsValid){var data = context.Find(pr.Id);if(data !=null){
data.Category= pr.Category;
context.Commit();}else{
context.Insert(pr);
context.Commit();}returnRedirectToAction("Index");}returnnewJsonResult{Data=new{ status = status }};}</div>