1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    1
    Vote Rating
    0
    sarah eldaw is on a distinguished road

      0  

    Default Unanswered: cross domain requests using ext.data.httpproxy

    Unanswered: cross domain requests using ext.data.httpproxy


    Hello..am trying to activate the autocomplete feature of Ext.form.combobx using the following code:

    var RecordDef = Ext.data.Record.create([
    {name: 'description', mapping: 'description'},
    {name: 'lat' , mapping: 'lat'},
    {name: 'lng' , mapping:'lng'}
    ]);
    var ds = new Ext.data.Store({
    model: 'RecordDef',
    proxy: new Ext.data.HttpProxy({url:'geo-multi.xml', method:'GET'}),
    reader: new Ext.data.XmlReader({
    root : 'geocoderResults',
    totalRecords: 'count',
    record: 'result'
    })
    });


    var timePanel = {
    xtype: 'panel',
    border: false,
    width: 600,
    bodyPadding: 10,
    layout: 'anchor',

    items: [{
    xtype: 'combo',
    displayField: 'title',
    store: ds,
    typeAhead: false,
    hideLabel: true,
    hideTrigger:true,
    anchor: '100%',
    listConfig: {
    loadingText: 'Searching...',
    emptyText: 'No matching posts found.',

    // Custom rendering template for each item
    getInnerTpl: function() {
    return '<div class="search-item">' +
    '<h3><span>{[Ext.Date.format(values.lastPost, "M j, Y")]}<br />by {author}</span>{title}</h3>' +
    '{excerpt}' +
    '</div>';
    }
    },
    pageSize: 10,
    },

    {
    xtype: 'component',
    style: 'margin-top:16px',
    html: 'live search'
    }]
    };
    I have the following problem:
    1- the returned xml content type header is not xml but instead html and this is the output from firebug console:
    Connection Keep-Alive
    Content-Length 409
    Content-Type text/html;charset=ISO-8859-1
    Date Tue, 10 Apr 2012 14:08:29 GMT
    Last-Modified Sun, 08 Jan 2012 08:11:37 GMT
    Server Winstone Servlet Engine v0.9.10
    X-Powered-By Servlet/2.5 (Winstone/0.9.10)
    this is the first problem
    my second problem is that i have a php code that am using to generate my xml file, and its resident in a different domain from the application that am trying to activate the autocomplete combobox....how can i make cross domain requests through ext.data.scripttagproxy , which is not working in my case and giving me lots of errors ... can any one help please

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Answers
    3542
    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 PHP code will need to adjust the header of the response.

    Ajax proxy (there technically is no http proxy anymore, it was renamed to ajax) cannot do cross origin requests. JsonP allows the ability to do cross domain requests but requires JSON and a valid JsonP response.
    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.