标签:async local hasclass pen tor 更改 content ssid sid
$(function(){
$(document).on(‘tap‘,‘.w-location-group .mui-table-view-cell‘,function(){
var bool = $(this).find(‘span.location-ico‘).attr(‘data-id‘) == 1;
var boolen = $(‘.write-del span‘).hasClass(‘bianji504‘);
if(boolen){
$(‘.w-location-group .mui-badge .location-ico‘).removeClass(‘duigou506‘);
$(this).find(‘span.location-ico‘).addClass(‘duigou506‘);
var valToken = JSON.parse(localStorage.getItem(‘token‘));
var addressId = $(this).find(‘span.mui-badge‘).attr(‘data-id‘);
var urlajax = ‘/api/address/‘+addressId;
$.ajax({
url:urlajax,
dataType:‘json‘,
async:true,
type:‘put‘,
headers:{‘Accept‘: ‘application/json‘,‘Authorization‘:‘Bearer ‘+ valToken},
complete:function(data){
if(data.responseText == ‘success‘){
layer.open({
content: ‘选择成功‘
,skin: ‘msg‘
,time: 2 //2秒后自动关闭
});
localStorage.removeItem(‘defalutshopId‘);
localStorage.removeItem(‘shopId‘);
}
}
});
}
ajax 请求发出了,数据更改了,但是没进入success 函数 把success 换成 complete
标签:async local hasclass pen tor 更改 content ssid sid
原文地址:http://www.cnblogs.com/winyh/p/6500870.html