I am new to MVC3 and jQuery. Perhaps I am not taking the right approach to this, please let me know if there is a better solution.
I want to use jQuery to change the views in my MVC application. I have a list of products on the main page. When the user clicks on the product, I Jquery sends a request to the server with the product identifier and proceeds to present the product information. Before I change the view, I make the jQuery effect explode. I am using the jQuery effect callback function to send a query. When I debug my code. The product part controller is called and it returns a view of the parts. But the web browser does not change the appearance of the product details. he remains on the main page.
Here is my product controller:
public class ProductController : Controller
{
public ActionResult Details(string productId)
{
return View();
}
}
JQuery :
$(".productOriginal").click(function () {
$(this).hide("explode", {}, 1000, productSelectedCallback);
});
Jquery:
function productSelectedCallback() {
var prodId = $(this).attr("id");
var data = { productId: prodId.toString() };
$(this).load('/Product/Details');
}
.load, .post .ajax . , - .
. , , details.cshtml.
!