开发者

is it possible to access cross site POST method in Extjs4

开发者 https://www.devze.com 2023-04-07 16:11 出处:网络
i try with this code it ispossible to access get method but i wont to access post method so how can i do that

i try with this code it is possible to access get method but i wont to access post method so how can i do that

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();

is there any way to post cross site data in extjs4


If you mean that you want to post data cross-domain...no, you can't. I know that with the new Javascript Api's (XMLHttpRequest2) it can be done but I don't know if that is an option for you right now.


try use jquery

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

精彩评论

暂无评论...
验证码 换一张
取 消