开发者

extjs ajax post

everyone! i'm trying to create ExtJs form and post some data to my php script. heres the code of the button:

    var btnChk = new Ext.Button({
    text: 'Check',
    handler: function(){
    var conn = new Ext.data.Connection();
    conn.request({
           method:'POST',
           url: 'tmp.php',
           success: function(){alert('ok')},
           failure: function(){alert('not ok')},
           params: { foo: 'bar' }
    });

when i hit this button the message is 'ok', so i guess it's a success. but i can't see any $_POST in my php - it's开发者_JAVA百科 just an empty array. what i'm doing wrong? (i'm realy new to ext and ajax)


A success return doesn't just mean that the data was sent, but that the file was located and successfully sent data.

What PHP code are you using?

Be sure to use the $_POST variable array and not $_GET

Try the following conn.request code

var conn = new Ext.data.Connection();
conn.request({
    method: 'POST',
    url: 'tmp.php',
    params: {
        foo: "bar"
    },
    success: function(responseObject) { alert(responseObject.responseText); },
    failure: function() { alert("Failed!"); }
});

What does the responseText say?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜