小编Luk*_*uke的帖子

为什么响应头从CORS AJAX响应中为空?

使用jsonp的AJAX请求到外部Play!1.2.4 Heroku上的应用程序,它成功返回数据,返回null getResponseHeaders().

这是我的代码:

var ajaxresult;
    ajaxresult = $.ajax({
    'complete': function (jqXHR, status) {            
        console.log('Complete!');
        console.log(status);
        console.log("on compelte: " + jqXHR.getAllResponseHeaders());
    },
    'dataType': "jsonp",
    'error': function (jqXHR, status, error) {
        console.log('Error!');
        console.log(status);
        console.log(error);
        console.log("on error: " + jqXHR.getAllResponseHeaders());
    },
    'success': function (data, status, jqXHR) {
        console.log('Success!');
        console.log(status);
        console.log(data);
        console.log("on success: " + ajaxresult.getAllResponseHeaders());
        console.log("on success(2): " + jqXHR.getAllResponseHeaders());
    },
    'type': 'GET',
    'url': url + "findAllSpecials"
});
Run Code Online (Sandbox Code Playgroud)

如果我转储jqXHR的内容,我得到:

"readyState: 4","setRequestHeader: function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this}","getAllResponseHeaders: function(){return s===2?n:null}","getResponseHeader: function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c}","overrideMimeType: function(a){s||(d.mimeType=a);return this}","abort: …
Run Code Online (Sandbox Code Playgroud)

jquery playframework response-headers playframework-1.x

3
推荐指数
1
解决办法
5234
查看次数

在重复项中选择不同的连续行

我有一个具有以下结构的表:

create table roster
(
date date not null,
first nvarchar(20) not null,
second nvarchar(20) not null,
third nvarchar(20) not null,
fourth nvarchar(20) not null,
)
go
Run Code Online (Sandbox Code Playgroud)

并且插入了以下数据:

insert into roster values ('2015-06-10 12:45:34', 'e', 'm', 'a', 'r')
insert into roster values ('2015-06-11 12:45:34', 'e', 'v', 'a', 'r')
insert into roster values ('2015-06-12 12:45:34', 'e', 'm', 'a', 'd') 
insert into roster values ('2015-06-13 12:45:34', 'e', 'm', 'a', 'd') *
insert into roster values ('2015-06-14 12:45:34', 'e', 'm', 'a', 'r')
insert …
Run Code Online (Sandbox Code Playgroud)

sql sql-server sql-server-2008-r2

1
推荐指数
1
解决办法
900
查看次数

重用异步管道(可观察)输出

我试图利用async管道在Angular中显示表,但出现错误:“ ...找不到类型为'object'的其他支持对象'[object Object]'。NgFor仅支持绑定到Iterables例如数组。”

我的代码:

<div *ngIf="studentList | async; else loading">
  <table>
    <tr>
      <th>ID</th>
      <th>First Name</th>
      <th>Last Name</th>
    </tr>
    <tr *ngFor="let student of studentList">
      <td>{{student.id}}</td>
      <td>{{student.first_name}}</td>
      <td>{{student.last_name}}</td>
    </tr>
  </table>
  {{studentList | json}}
</div>

<ng-template #loading>
  <div>Loading ...</div>
</ng-template>
Run Code Online (Sandbox Code Playgroud)

后端返回 Observable<Student[]>

如果我将ngFor以下内容替换为,则可以使用,但这意味着要进行两个HTTP.get调用,但我不希望这样做:

<tr *ngFor="let student of (studentList | async)">
Run Code Online (Sandbox Code Playgroud)

有我的方式再利用的价值studentListngIfngFor,从而使得只有一个请求到我的后台?

asynchronous observable angular

1
推荐指数
2
解决办法
543
查看次数