jQuery global variable problem

前端 未结 6 873
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 10:58
var id = $(this).children().html();  // id is 5
$.ajax({
   url: \'ajax.php?id=\' + id,
   success: function(data) {
      id = data;   // id is 1
   }
});
if(id == 1){          


        
6条回答
  •  我在风中等你
    2021-01-22 11:18

    The A in Ajax is for Asynchronous. From within the 'success' callback you can call another function or execute post-ajax code.

提交回复
热议问题