Home >Web Front-end >JS Tutorial >What are the common methods of jquery
Commonly used methods of jquery are: 1. ".bind()" method; 2. ".unbind()" method; 3. ".css()" method; 4. ".hasclass()" Method; 5. ".removeclass" method; 6. ".parent()" method, etc.
Recommended: "jquery Video Tutorial"
Several jQuery Commonly used methods
.bind()
.unbind()
.css()
.hasclass()
.removeclass
.parent()
.children()
.html()
.hide()
.show()
.attr()
.val()
##The three most commonly used methods of jQuery AJAX
<script> //把所有需要用到的地址归类到一个对象里 var webUrl = { "show1Url": "{{ url('address/list1') }}", "show2Url": "{{ url('address/list2') }}", "show3Url": "{{ url('address/list3') }}" }; // get方式 function getData() { $.get(webUrl.show1Url, //获取地址 function(json){ console.log(json); }); } // post方式 function postData(v1) { $.ajaxSettings.async = true; //在这里设置同步或异步 默认为true(可不写) false为同步 $.post(webUrl.show2Url, //获取地址 { "id":v1 //需要传输的数据 }, function(json){ console.log(json); }); } // ajax方式 function fullData(id) { $.ajax({ // AJAX 请求设置。所有选项都是可选的。 async:false, //请求是同步或异步 默认为true 为true时不用写 type: "POST", //设置类型 url: webUrl.show3Url, //数据传输地址 dataType: "json", //获取的数据类型 data: {"id":id}, //传参 success: function (json) { //请求成功之后调用 // console.log(json); console.log(json); }, error: function () { //请求出错时调用 console.log("请求失败"); } }) } </script>
The above is the detailed content of What are the common methods of jquery. For more information, please follow other related articles on the PHP Chinese website!