1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    3
    Vote Rating
    0
    rishigupta is on a distinguished road

      0  

    Default Unanswered: Error during hooking up service running on a different port

    Unanswered: Error during hooking up service running on a different port


    Getting error while calling a rest service running on a different port. although I can see my service is getting called and returning data as follows however getting error as "Uncaught SyntaxError: Unexpected token : "

    JSON Data :
    {"data":[{"fundId":"123450","fundDescription":"High Risk Equity Fund 1","bidPrice":28.194580087369296,"offerPrice":32.50324735115754,"lastUpdated":"2013-09-09T12:36:38"},{"fundId":"123451","fundDescription":"High Risk Equity Fund 2","bidPrice":35.4491138589059,"offerPrice":29.723931563223637,"lastUpdated":"2013-09-09T12:36:38"}]}

    Not sure where/ what is wrong. Any help much appreciated.

    Here is my store & model.

    Store: fund.js
    Ext.define('AM.store.fund', {
    extend: 'Ext.data.Store',
    model: 'AM.model.fund',
    requires: [
    'Ext.data.proxy.JsonP'
    ],
    autoLoad: true,

    proxy : {
    type: 'jsonp',
    //callbackKey: 'callback',
    url: 'http://localhost:8090/spring-rest-sample/rest/funds/',
    headers: {
    'Accept': 'application/json'
    },
    reader: {
    type: 'json',
    root: 'data',
    successProperty: 'success'
    },
    afterRequest: function(req, res) {
    console.log("Ahoy!", req.operation.response);
    }

    },

    listeners: {
    load: function(store, records, success) {
    console.log("Load: success " + success);
    },
    exception:function(proxy, response){
    console.error(response.responseText);
    }
    }
    });

    Model
    fund.js

    Ext.define('AM.model.fund', {
    extend: 'Ext.data.Model',

    //fields: ['fundId','fundDescription','bidPrice','offerPrice']
    fields: [
    {name: 'fundId', type: 'string'},
    {name: 'fundDescription', type: 'string'},
    {name: 'bidPrice', type: 'float'},
    {name: 'offerPrice', type: 'float'},
    {name: 'lastUpdated', type: 'date'}
    ]
    });

  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    3,277
    Answers
    141
    Vote Rating
    63
    Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough

      0  

    Default


    Strange error message. If you are running on a different port, are you using CORS?

  3. #3
    Sencha User
    Join Date
    Sep 2013
    Posts
    3
    Vote Rating
    0
    rishigupta is on a distinguished road

      0  

    Default


    No, I am not.

  4. #4
    Sencha User
    Join Date
    Sep 2013
    Posts
    3
    Vote Rating
    0
    rishigupta is on a distinguished road

      0  

    Default


    although if you mean whether my service is running on a different server on the same machine using a different port, then yes.

  5. #5
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    3,277
    Answers
    141
    Vote Rating
    63
    Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough

      0  

    Default


    My understanding is that a different port is a different domain, so you might try it with CORS.

  6. #6
    Sencha User
    Join Date
    Jan 2011
    Location
    San Juan, PR
    Posts
    80
    Vote Rating
    5
    vela1606 is on a distinguished road

      1  

    Default


    You don't have to use CORS if using jsonp
    Not sure what language are you using in your server, but the Sencha JsonP documentation has a very good examples. JosnP

    But I was you, I would use CORS with startd AJAX request
    |:| GaiaEHR |:| A Open Source Software for Electronic Health Records - Lead Developer

Thread Participants: 2

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