加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

How to run an ajax call after another ajax call?

发布时间:2020-12-16 00:29:01 所属栏目:百科 来源:网络整理
导读:http://stackoverflow.com/questions/1995355/how-to-run-an-ajax-call-after-another-ajax-call $ ( ".bt_login" ). click ( function (){ $ . ajax ({ type : 'POST' , url : 'widgets/Login/loginProcess.php' , data : dataString , success : function

http://stackoverflow.com/questions/1995355/how-to-run-an-ajax-call-after-another-ajax-call

$(".bt_login").click(function (){ $.ajax({ type: 'POST', url: 'widgets/Login/loginProcess.php', data: dataString, success: function(data){ if(data == 'error'){ alert('Wrong username and/or password!'); }else{ $('#loginForm').html(data); $('#greet').html('Hello '+username+'!').fadeIn(); $('#open').html('Open Panel'); // because .bt_logout only exists after this point: $('.bt_logout').click(function (){ var dataString = 'process=logout'; $.ajax({ type: function(data){ $('#loginForm').hide().html(data).fadeIn(); $('Hello Guest!'); $('Log In | Register'); } }); }); } } }); });

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读