1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    36
    Vote Rating
    0
    PabloPerezAdsuar is on a distinguished road

      0  

    Default Unanswered: The best way to make requests is..

    Unanswered: The best way to make requests is..


    Hi, I am developing a app for mobile with Sencha Touch 2.2 and I need to receive data using a web service requests but I don't know the best way to make it.

    Now I'm using Ajax, but I read that is not correct. It also gives me a problem (OPTIONS http://172.16.0.47/..):

    Sin título.jpg
    Code:
    var parametros ={
            nci: localStorage.getItem("nci"),
            Ticket: localStorage.getItem("guid"),
            TablaClaveiSAT: tabla,
            NumUltimaSinc: timestamp,
            NumRegistroPaginaDesde: 0,
            NumRegistroPaginaHasta: 0
        }
    
    
    Ext.Ajax.request({
            url: "http://172.16.0.47/ClaveiSAT/Service1.svc/SincronizarTabla",
            method: 'GET',
            params: parametros,
            success: function(response) {//SUCCESS LLAMADA
                //Capturo el resultado
                var respuesta = JSON.parse(response.responseText);
                console.log(respuesta);
            },
            failure: function(response) {//ERROR LLAMADA
                //console.log(response);
    
    
            }
    });


    What is the best way to get data from a web service??

    Thank

  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


    The OPTIONS request is the browser checking the server that you are trying to send an Ajax request to supports CORS which in this case the server doesn't know how to handle OPTIONS requests.
    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.

Thread Participants: 1

Tags for this Thread