1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    1
    gserio is on a distinguished road

      0  

    Default Unanswered: AJAX->POST->content type:application/json

    Unanswered: AJAX->POST->content type:application/json


    Hi,
    i would love to make this post request:

    Request:
    POST /api/v1/admin/tokens HTTPS/1.1
    Content-Length: 57
    Connection: keep-alive
    Content-Type: application/json
    {"username": "rcotlarc@abrand.com", "password": "12cra13"}
    that will produce this
    Response:
    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    Content-Length: length
    {"token":"42ab136d77ce4e57a931db9e3299c2c82db5b406ad034bcb924e73fe894fcfb1"}

    And display the " token"

    here's the point that i'm at:
    send: function()
    {
    Ext.Ajax.request({
    url: 'https://host/api/v1/admin/tokens',
    defaultHeaders: { 'Content-Type': 'application/json' },
    method:'Post',
    params: {
    "username": "root@abrand.com", "password": "12cra13"
    },

    success: function(response, opts) {
    var obj = Ext.decode(response.responseText);
    console.dir(obj);
    },
    failure: function(response, opts) {
    console.log('server-side failure with status code ' + response.status);
    }
    });
    }

    Can anyone share the knowledge on this?
    thanks!

  2. #2
    Sencha User
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    1
    gserio is on a distinguished road

      1  

    Default


    got it...
    send: function()
    {
    Ext.Ajax.useDefaultXhrHeader=false;
    Ext.Ajax.request({
    url: 'https://ahost/api/v1/admin/tokens',
    headers: {
    'Content-Type' : 'application/json' },
    method:'Post',
    jsonData: {
    username: "rcotlarc@abrand.com", password: "12cra13"
    },


    success: function(response, opts) {
    var obj = Ext.decode(response.responseText);
    console.dir(obj);
    },
    failure: function(response, opts) {
    console.log('server-side failure with status code ' + response.status);
    }
    /*
    Ext.lib.Ajax.useDefaultXhrHeader = false;
    */
    });

    thanks anyway!

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    23
    Vote Rating
    1
    Manoj Solanki is on a distinguished road

      0  

    Default


    Hi Gserio,

    Thanks a lot.... For these greate help....


Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi