在Extjs4中是否可以访问跨站点POST方法?

is it possible to access cross site POST method in Extjs4

本文关键字:站点 POST 方法 访问 Extjs4 是否      更新时间:2023-09-26

我试着用这段代码可以访问get方法但我不想访问post方法那么我怎么做呢

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中发布跨站点数据

如果你想跨域发布数据…不,你不能。我知道,有了新的Javascript Api (XMLHttpRequest2),它可以做到,但我不知道这是否适合你现在的选择。

尝试使用jquery

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