1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    7
    Vote Rating
    0
    pdominique is on a distinguished road

      0  

    Question Unanswered: How to send an HTTP POST request with request body content

    Unanswered: How to send an HTTP POST request with request body content


    Hi,

    I'm new to Sencha touch and ExtJS and I'd like to send an HTTP POST request with some content in the request body (something like param1=value1&param2=value2). As far as I understand I'm supposed to use a writer but I really have no idea how to do that.

    Here's my code :

    app.stores.records = new Ext.data.Store({
    model: "app.models.Record",
    autoLoad:true,
    proxy: {
    type: 'ajax',
    url : 'http://hostname/mywebservice.aspx',
    method : 'POST',
    reader: {
    type: 'xml',
    record: 'RECORD'
    },
    headers: {
    'Content-type': 'application/x-www-form-urlencoded',
    'Host': 'hostname',
    'User-Agent': 'useragent',
    'Accept': '*/*'
    },
    writer: {
    ?????????
    }
    }
    });

    Cheers,

    Pierre

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,994
    Answers
    3487
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    http://docs.sencha.com/touch/1-1/#!/...data.XmlWriter

    Code:
    proxy : {
        type : 'ajax',
        url : 'someUrl.xml',
        reader : {
            type : 'xml'
        },
        writer : {
            type : 'xml'
        }
    }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    7
    Vote Rating
    0
    pdominique is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    http://docs.sencha.com/touch/1-1/#!/api/Ext.data.XmlWriter

    Code:
    proxy : {
        type : 'ajax',
        url : 'someUrl.xml',
        reader : {
            type : 'xml'
        },
        writer : {
            type : 'xml'
        }
    }
    Thanks for the reply but I still don't see how to use a writer to put some content in my POST request body. I just want to pass a few params : param1=value1&param2=value2

    Cheers,

    Pierre

Thread Participants: 1