1

我正在使用 ExtJs,我需要在 Ext.Ajax.request 中传递一个日期,但我不知道该怎么做。我正在尝试以下代码:

dateController: function(botao){
    Ext.Ajax.request({
        url: Webapp.link("research/2012-09-18T14:30:00/8"),
        method: 'get',
        success: function(response){
            console.log(response);
        }
    });
}

URL 中的第一个参数是日期,第二个参数是产品 ID。

4

1 回答 1

2

怎么样

dateController: function(botao){
    Ext.Ajax.request({
        url: "YourUrl?research=2012-09-18T14:30:00",
        method: 'get',
        success: function(response){
            console.log(response);
        }
    });
}

或者你可以使用参数来做到这一点(我从来没有用 get 试过这个,但它应该也能工作

Ext.Ajax.request({
    url : 'YourUrl',
    method:'get', 
    params : {
       research: Ext.encode("2012-09-18T14:30:00")
    },
    scope : this,
    //method to call when the request is successful
    success : this.onSuccess,
    //method to call when the request is a failure
    failure : this.onFailure
 });
于 2012-09-25T11:55:26.577 回答