Jquery的同步和异步请求
来源:互联网 发布:美橙互联域名证书 编辑:程序博客网 时间:2024/06/15 22:58
1 异步请求:
1.1 $.ajax
$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : true,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});
2 同步请求
2.1 $.ajax
$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : false,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});
2.2 $.post
$.post(
'your url',
{name:value},
function(data) {
do something...
},
'json/xml/html'
1.1 $.ajax
$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : true,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});
2 同步请求
2.1 $.ajax
$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : false,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});
2.2 $.post
$.post(
'your url',
{name:value},
function(data) {
do something...
},
'json/xml/html'
);
eg.
//判断权限
function judge_authority(val)
{
$.ajax({
type:'POST',
url:'data.php',
data: 'actionid='+ val,
async : false,
success:function(data){
if(data=='0'){
alert('没有权限进行此操作');
val=0;
}else{
val=1;
}
},
error : function(data) {
alert('执行出错');
}
});
//$.get("data.php?actionid"+val, function(data){ if(data==0){val=0;}else{val=1;}});
//$.post('data.php', { actionid: val }, function (data) { if(data==0){val=0;}else{val=1;} });
alert(val);
}
0 0
- jquery 同步和异步的请求方式
- Jquery的同步和异步请求
- Jquery的同步和异步请求
- Jquery的同步和异步请求
- JQUERY中的同步和异步请求
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- 同步请求和异步请求的区别
- OkHttp的同步请求和异步请求
- 同步和异步请求
- 异步请求和同步请求
- 同步请求和异步请求
- 同步请求和异步请求
- 同步请求和异步请求
- JS转换HTML转义符的方法
- View Animator(Tween Animator)、Drawable Animator(Frame Animator)、Property Animator
- [生存志] 第75节 礼经士礼尚书记言
- 更改ToolBar的样式(侧边栏联动箭头颜色,字体大小和颜色)
- SSH之Spring传统方式接入YAML管理各环境配置方式(从Spring Boot移植)
- Jquery的同步和异步请求
- StringBulider示例
- 基于TCP的服务器端/客户端(二)---------网络编程(Linux----C)
- 73. Set Matrix Zeroes
- 浏览器广告插件导致程序无法正常加载
- MATERIAL DESIGN的学习笔记
- find 及权限
- okhttp封装
- [bigdata-002]python3 +flask 以post方式获取json的api