在jQuery中ajax配置项中的使用type与method的区别:
type 和method 一样的含义,只是mthod是version1.9添加的,所以版本1.9之前的使用type 之后的使用method。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>X-editable starter template</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- bootstrap --> <link href="https://cdn.bootcss.com/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.bootcss.com/jquery/2.0.3/jquery.min.js"></script> <script src="https://cdn.bootcss.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <!-- x-editable (bootstrap version) --> <!--关键字:bootstrap-editable cdn 版本:1.4.6 --> <link href="https://cdn.bootcss.com/x-editable/1.4.6/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"> <script src="https://cdn.bootcss.com/x-editable/1.4.6/bootstrap-editable/js/bootstrap-editable.min.js"></script> <!----> <script type="text/javascript"> $(document).ready(function() { //(function(){})不支持,必须ready才执行 //toggle `popup` / `inline` mode $.fn.editable.defaults.mode = ‘popup‘; //make username editable $(‘#username‘).editable(); //make status editable $(‘#status‘).editable({ type: ‘select‘, title: ‘Select status‘, placement: ‘right‘, value: 2, source: [ {value: 1, text: ‘status 1‘}, {value: 2, text: ‘status 2‘}, {value: 3, text: ‘status 3‘} ] }); }); </script> </head> <body> <div class="container"> <h1>X-editable starter template</h1> <div> <span>Username:</span> <a href="#" id="username" data-type="text" data-placement="right" data-title="Enter username">superuser</a> </div> <div> <span>Status:</span> <a href="#" id="status"></a> </div> </div> </body> </html>
原文:https://www.cnblogs.com/fger/p/11489772.html