首页 > Web开发 > 详细

jQuery异步提交与JSON解析

时间:2015-11-17 18:42:14      阅读:280      评论:0      收藏:0      [点我收藏+]

<script type="text/javascript">
function btn_praise(txtTypeId) {
var txtRowGuidMain = $("#hide_RowGuidMain").val();
var txtUserId = $("#hide_UserId").val();
if (txtRowGuidMain == ‘‘ || txtUserId == ‘‘) {
alert(‘对不起,操作失败!‘);
}
else {
$.ajax({
type: "POST", //用POST方式传输
url: ‘../AddPriseHandler.ashx‘, //目标地址
dataType: "json" ,//需要限定
data: { RowGuidMain: txtRowGuidMain, UserId: txtUserId, TypeId: txtTypeId },
success: function (data) {

//此处返回值假设为{"message":"成功","result":16}

alert(data.message);
$(this).attr("value", data.result)
},
error: function () {
alert("异常!");
}
})
}
};
</script>

jQuery异步提交与JSON解析

原文:http://www.cnblogs.com/sulong/p/4972290.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!