jq ajax 这几字母含义实在太深,小弟不能领悟!

解决方案 »

  1.   

    http://www.w3school.com.cn/example/ajax_examples.asp
      

  2.   

    You can also use AJAX to populate the tree with JSON your server returns. The format remains the same as the above, the only difference is that the JSON is not inside the config object, but returned from the server.To take advantage of this option you need to use the $.jstree.defaults.core.data config option.Just use a standard jQuery-like AJAX config and jstree will automatically make an AJAX request populate the tree with the response.In addition to the standard jQuery ajax options here you can supply functions for data and url, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used as URL and data respectively.If you do not return correct json headers from the server, at least set the dataType jQuery AJAX option to "json".$('#tree').jstree({
    'core' : {
      'data' : {
        'url' : function (node) {
          return node.id === '#' ? 
            'ajax_roots.json' : 
            'ajax_children.json';
        },
        'data' : function (node) {
          return { 'id' : node.id };
        }
      }
    });