hi,
well , i have an e-commerce app, when i click at "add to cart" button , i want that this article is added to cart without loading this page.
I know , i have to work with ajax, i did that, but when i click into the button , nothing appears in the cart, but when i load manually the view , i see the article added,
this is the structure of my app
1/_layout.cshtml : call 2 another views :
1-1/_cartshop.cshtml : contains the cart
1-2/index.chstml , contains the list of articles , also contains the ajax button
this is my method in homecontroller :
public PartialViewResult addtocart(int id)
{
// article added to the list
return PartialView("_cartshop");
}
Loading
Atul BandPosted Jun 30, 2014, 8:01 AM
You have use following ajax link button and put your partial view under the divtarget
@Ajax.ActionLink("Link Text", "ActionMethod", "Controller", new AjaxOptions{UpdateTargetId="divtarget ",HttpMethod = "Post" , InsertionMode = InsertionMode.Replace })