pyrebot

Better not to ignore the past but learn from it instead. Otherwise, history has a way of repeating itself.

博客园 首页 新随笔 联系 订阅 管理

方式一:

$.ajax({ 
          type : "post", 
          url : "user/add", 
          data : data, 
          async : false, //必须为false
          success : function(para){ 
            para= eval("(" + para+ ")"); 
            alert(para)
          } 
          }); 

方式二(JQ):

$.ajaxSetup({ 
    async : false 
});//为全局变量,必须加,否则同步不了
 
$.get("user/add", data, function(para) { 
    if (para.result== "成功") { 
        alert("data is " + para.data); 
    } else { 
            alert("wrong"); 
         } 
}); 
posted on 2014-07-17 17:31  pyrebot  阅读(601)  评论(0编辑  收藏  举报