二种ajax

前端之家收集整理的这篇文章主要介绍了二种ajax前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.

  1. $.ajax({
  2. type:"post",dataTyep:"json",async: false,//取消异步
  3. url:"check_username.jspx",data:{
  4. username:username
  5. },success : function(result) {
  6. if (result.result == 0) {
  7. $("#uName").show();
  8. $("#uName").html("用户名已经使用");
  9. flag = false
  10. } else {
  11. $("#uName").hide();
  12. flag = true
  13. }
  14. }
  15. })

2.
  1. $.post($("#registform").attr("action"),$("#registform").serialize(),function(result) {
  2. if(result.success) {
  3. layer.msg("注册成功!");
  4. setInterval("window.location.href = '/';",1000);
  5. return ;
  6. }
  7. layer.msg("注册失败!" + result.FailedMessage);
  8. });

猜你在找的Ajax相关文章