title: How to invoke MVC3 ViewResult action from jquery/javascript?
body: <p>How can I call a ViewResult controller action/method from jquery/javascript using something similar to the  following code:</p>
  
  <p>Index.cshtml (callback for multiselect):</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
          $("select").multiselect({
              click: function (event, ui) {
                  // item selected
                  //
                  // Also, not sure how I can pass in values from a multiselect to update my grid
                  // ...using ajax or post???
                  $.post(
                      '@Url.Action("Index","Main")'); 
                       //, { value: ui.value, state: ui.checked ? 'checked' : 'unchecked' });
                       // call my index() and get values or pass in values from multiselect
                  // or...
                  $.ajax(
                     { url: '@Url.Action("Index","Main")'...// }
                      //, { value: ui.value, state: ui.checked ? 'checked' : 'unchecked' });
                      // call my index() and get values or pass in values from multiselect
                                  })
              }
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> // GET: /Main/
      public ViewResult Index(/* not sure if possible */ 
           /* get values from multiselect */
           string[] MultiselectId)
      {
          // Populate default grid view
          IList&lt;CModel&gt; cs = db.CModels.OrderByDescending(x =&gt; x.CName).ToList();
  
         // get values in #multiselect and filter grid contents based on that filter value
         // if a filter was selected...
  
         return View(cs);
      }
  </code></pre>