亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

同步的 XMLHttpRequest 已不推薦使用 , 那怎么實現同步操作呢 ?

同步的 XMLHttpRequest 已不推薦使用 , 那怎么實現同步操作呢 ?

hhhzihao2 2016-05-16 17:03:45
$(function?()?{ ??$("img[id^='isshow']").click(function()?{ ????var?$id?=?$(this).attr('id').replace('isshow',?''); ????if?($(this).attr('src').match('yes'))?{ ??????var?$isshow?=?'yes'; ??????var?$newisshow?=?'no'; ????}?else?{ ??????var?$isshow?=?'no'; ??????var?$newisshow?=?'yes'; ????} ????var?$data?=?0; ????$.ajax({ ??????type:?'post', ??????url:?'__URL__/isshowPro', ??????//?async?:?false, ??????data:?{'id':$id,?'isshow':$newisshow}, ??????success:?function?(data)?{ ????????$data?=?data; ??????} ????}); ????if?($data?==?1)?{ ??????$(this).attr('src',?function?()?{ ??????????return?$(this).attr('src').replace($isshow,?$newisshow); ??????}); ????} ??})?? }) 如果?//?async?:?false?,?打開?,?火狐會出現這個警告?: "主線程中同步的?XMLHttpRequest?已不推薦使用,因其對終端用戶的用戶體驗存在負面影響。更多幫助請見?http://xhr.spec.whatwg.org/" 問?:?如果?async?:?true?,?如何同步地實現這段代碼?? if?($data?==?1)?{ ??????$(this).attr('src',?function?()?{ ??????????return?$(this).attr('src').replace($isshow,?$newisshow); ??????});
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 16620 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號