0
var response_data = jQuery.ajax({
    dataType: 'json',
    url: '/segments/'+ id + '/edit_user.json?context=' + context,
    type: 'POST',
    success: function(data){
      return data;
    }
  });
  if (response_data.warn_user == 'true'){
    return true 
  }else {
    warn_segment_edit('This field is presently being edited by ' + response_data.user_name + ' wait until editing is complete')
    return false 
  }

我得到这个字段目前正在被undefined编辑,等待编辑完成

有没有办法做到这一点。

谢谢

4

1 回答 1

0

你可以这样做:

jQuery.ajax({
   dataType: 'json',
   url: '/segments/'+ id + '/edit_user.json?context=' + context,
   type: 'POST',
   success: function(data){
     if (data.warn_user == 'true'){
        return true;
     }else {
        warn_segment_edit('This field is presently being edited by ' +   data.user_name + ' wait until editing is complete');
        return false;
     }
   }
});
于 2012-06-19T11:27:09.593 回答