Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 Change View from Jquery
    primarykey
    data
    text
    <p>I am new to MVC3 and Jquery. Maybe i am not taking the right approach to this, please let me know if there is a better solution.</p> <p>I want to use JQuery to change views in my MVC app. I have a list of products on the main page. When the user clicks a product, I Jquery to send a request to the server with the product ID and change to a product details view. Before I change views, i do Jquery explode effect. I am using the callback function of the Jquery effect to submit the request. When i debug my code. The product details controller is called and it returns the details view. But the web browser does not change the the product details view. it stays on the home page.</p> <p>Here is my product controller:</p> <pre><code>public class ProductController : Controller { public ActionResult Details(string productId) { return View(); } } </code></pre> <p>Jquery explode effect with callback:</p> <pre><code>$(".productOriginal").click(function () { $(this).hide("explode", {}, 1000, productSelectedCallback); }); </code></pre> <p>Jquery Callback:</p> <pre><code>function productSelectedCallback() { var prodId = $(this).attr("id"); var data = { productId: prodId.toString() }; $(this).load('/Product/Details'); } </code></pre> <p>In addition to .load, i have use .post and .ajax and got the same result with all. So, i must be fundamentally missing something here.</p> <p>I am using the default register routes. The products folder is set up the same as the home folder and has a details.cshtml.</p> <p>Thanks for you help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload