2011-09-27 40 views
1

我尝试使用此代码,可以访问get方法,但我不会访问POST方法,所以我怎么能做到这一点是有可能访问跨站点POST方法Extjs4

Ext.define('User', { 

    extend: 'Ext.data.Model', 
    fields: ['id', 'name', 'email'] 
}); 

var store = Ext.create('Ext.data.Store', { 
    model: 'User', 
    restful:true, 
     proxy: { 
     type: 'jsonp', 
     url: 'http://localhost:8080/testapp/userreg', 
     callbackKey: 'Callback' 
    }, 

     headers: { 
        'Content-type': 'application/json', 
        'Accept': 'application/json'  
     } 
    }); 

    store.load(); 

有什么办法在extjs4中发布跨站点数据

回答

2

如果您的意思是您想要发布跨域数据...否,那么您不能。我知道用新的Javascript Api(XMLHttpRequest2)它可以完成,但我不知道现在是否有这种选择。

+0

我想补充一点,使用JSONP代理是将数据发送到一个跨域服务器用适当的方式,但由于提问者提示它使用脚本标记,并获得尽可能反对发布。 – LittleTreeX

0

尝试使用jQuery

$.ajax({ 
          type: 'POST', 
          url : urlServer+'/ws/Login/', 
          xhrFields: { 
           withCredentials: true 
          }, 
          scope: this, 
          dataType: 'json', 
          data:values, 
          timeout: 10000, 
          success: function(result, request) {