title: jQuery contextMenu load items via Ajax call
body: <p>I am using the below context menu plugin for jQuery 1.8.11.js and using the "build"  callback to dynamically create the menu on every click.</p>
  
  <p><a href="http://medialize.github.com/jQuery-contextMenu/index.html" rel="nofollow">http://medialize.github.com/jQuery-contextMenu/index.html</a></p>
  
  <p>I'd like to be able to load the menu options dynamically when an item is clicked (calling a controller method that determines the available options depending on the ID of the item)</p>
  
  <p>My problem is that this context menu library doesn't seem to support ajax calls, and if I try to make an ajax call in the 'build' callback, it obviously will not wait until the ajax call is complete.</p>
  
  <p>Here is a trimmed-down snippet of what I am trying to do:</p>
  
  <pre><code>$.contextMenu({
      selector: '" + contextMenuSelector + @"',
      build: function ($trigger, e) {
      menuOptionsArray = [];
          //Ajax START
          $.ajax({
               type: "POST",
               url: &lt;myurl&gt;,
               //async: false, //**IF I UN-COMMENT THIS, IT WORKS**
               context: $(this),
               success: function (data) {
                     //BUILD THE OPTIONS ARRAY
                     menuOptionsArray...
                  }
              });
           //Ajax END
  
           //This returns before the ajax call finishes               
           return {
              items: menuOptionsArray
          };
      }
  </code></pre>
  
  <p>In the above, setting async = false works, but since that is deprecated, I don't want to use that.</p>
  
  <p>Is there any other way to load the items asynchronously, or would this require a modification of the plugin?</p>