jquery的常用办法是什么
发布时间:12/01 来源:未知 浏览:
关键词:
jquery的常用办法有:1、“.bind()”办法;2、“.unbind()”办法;3、“.css()”办法;4、“.hasclass()”办法;5、“.removeclass”办法;6、“.parent()”办法等等。
引荐:《jquery视频教程》
jQuery的几个常用办法
.bind()
.unbind()
.css()
.hasclass()
.removeclass
.parent()
.children()
.html()
.hide()
.show()
.attr()
.val()
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>
以上就是jquery的常用办法是什么的具体内容,更多请关注百分百源码网其它相关文章!