zoukankan      html  css  js  c++  java
  • ajax post 同步异步问题

    //新的评论
    function sendCom(aId) {
        var currUrl = window.location;
        var liuyan = document.getElementById("liuyan");
        var txt = liuyan.outerHTML;
        if (txt == null || txt == "") {
            alert("回复内容不可以为空");
        } else {
            var check = checkLogin();
            if (check != "") //查看是否登录
            {
                $.ajax({
                    type: 'get',
                    url: "/user/AddCommentMsg",
                    async: false,//当不写时,在火狐和谷歌下,只有当一步一步执行js时,才会留言成功,执行addcommentmsg,否则只是刷新页面。这就是异步同步的问题。
                      //当不写时,默认为 异步 async:true data: { comment: liuyan.innerHTML, aId: aId, cId:
    null, currUrl: currUrl.href } }); window.location = currUrl.href.replace("#", ""); } else { alert("您还没有登录,请登录再评论"); } } }
  • 相关阅读:
    StateListDrawable状态选择器
    Shape
    每周随笔
    每周随笔
    每周随笔
    每周随笔
    每周随笔
    每周随笔
    每周随笔

  • 原文地址:https://www.cnblogs.com/nanxiaoxiang/p/2736711.html
Copyright © 2011-2022 走看看