jQuery $ajax $post $get
2016-06-21 10:23
507 查看
$("#inner").click(function () {
$.ajax({
type: 'post',
url: '__URL__/run1',
data:'{}',
dataType: 'json',
contentType: 'application/json;charset=utf-8',
beforeSend: function () {
running = true;
timer = setInterval(function () {
i += 5;
outter.style.webkitTransform = 'rotate(' + i + 'deg)';
outter.style.MozTransform = 'rotate(' + i + 'deg)'
}, 1);
},
success: function (data, textStatus) {
alert(textStatus);
var description = "";
for(var i in data){
var property=data[i];
description+=i+" = "+property+"\n";
}
alert(description);
alert(JSON.stringify(data));
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('XMLHttpRequest.status = '+XMLHttpRequest.status);
alert('XMLHttpRequest.readyState = '+XMLHttpRequest.readyState);
alert('textStatus = '+textStatus);
alert('errorThrown'+errorThrown);
},
complete: function (XMLHttpRequest, textStatus) {
},
timeout: 4000
})// $.ajax//;
$.post('__URL__/run1', '', function (data) {
alert("提交成功,谢谢您的参与");
alert(JSON.stringify(data));
}, "json")
})// $("#inner");//
});//$(function ()//
$.post('__URL__/run1', '', function (data) {
alert("提交成功,谢谢您的参与");
alert(JSON.stringify(data));
}, "json") ;
$.get("test.php", function(data){
alert("Data Loaded: " + data);
});
http://www.w3school.com.cn/jquery/jquery_ref_ajax.asp
$.ajax({
type: 'post',
url: '__URL__/run1',
data:'{}',
dataType: 'json',
contentType: 'application/json;charset=utf-8',
beforeSend: function () {
running = true;
timer = setInterval(function () {
i += 5;
outter.style.webkitTransform = 'rotate(' + i + 'deg)';
outter.style.MozTransform = 'rotate(' + i + 'deg)'
}, 1);
},
success: function (data, textStatus) {
alert(textStatus);
var description = "";
for(var i in data){
var property=data[i];
description+=i+" = "+property+"\n";
}
alert(description);
alert(JSON.stringify(data));
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('XMLHttpRequest.status = '+XMLHttpRequest.status);
alert('XMLHttpRequest.readyState = '+XMLHttpRequest.readyState);
alert('textStatus = '+textStatus);
alert('errorThrown'+errorThrown);
},
complete: function (XMLHttpRequest, textStatus) {
},
timeout: 4000
})// $.ajax//;
$.post('__URL__/run1', '', function (data) {
alert("提交成功,谢谢您的参与");
alert(JSON.stringify(data));
}, "json")
})// $("#inner");//
});//$(function ()//
$.post('__URL__/run1', '', function (data) {
alert("提交成功,谢谢您的参与");
alert(JSON.stringify(data));
}, "json") ;
$.get("test.php", function(data){
alert("Data Loaded: " + data);
});
http://www.w3school.com.cn/jquery/jquery_ref_ajax.asp
相关文章推荐
- Jquery.post方法在firefox浏览器不调用问题处理
- jQuery EasyUI使用教程之创建具有复选框节点的树
- jquery获取对象
- jQuery动态添加可拖动元素完整实例(附demo源码下载)
- jQuery中的ready函数与window.onload谁先执行
- jQuery AJAX timeout 超时问题详解
- jQuery代码性能优化的10种方法
- jquery动态菜单非常漂亮的网站雨刮器特效
- jQuery图表插件 jqPlot API 中文说明
- jQuery图表插件 jqPlot实现饼状图
- jQuery基础知识
- jquery ajax 分页
- jquery 学习日志-- AJAX load() 方法
- jquery 学习日志 - AJAX get() 和 post() 方法
- Jquery 相关
- jQuery 获取有多个class名的元素
- jQuery 简介 111
- PHP jQuery
- 【插件】自适应布局JQuery插件,rem布局——和派孔明
- jQuery源码学习(四)