• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

How to cross domains with Ext.ajax.request?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to cross domains with Ext.ajax.request?

    Hello,

    Im attempting to call an external api from outside our domain via the ajax Ext.ajax.request. We're sending data from a grid, to the api with the hopes of receiving the returned data and repopulating our grid.

    Im familiar with the ajax restrictions about cross domains. But Im attempting to use the scripttagproxy. Im unable to get this to work.

    Does anyone have any experience using Ext.ajax.request with scripttagproxy. Or an example. I can use all the help I can get

    Thank You

  • #2
    This is an example that works with Ext4:


    Code:
    Ext.define('customer', {
        extend: 'Ext.data.Model',
        fields: ['CUSNO', 'CNAME', 'CCITY', 'CSTATE']
    });
    	
    var dsCustomer = Ext.create('Ext.data.Store',{
        model : 'customer',
        autoLoad : true,
        proxy : {
    	type: 'jsonp',  // NOTE: type is "jsonp"
    	url: 'http://xxxxxxxxxxxxx/xxxx/xxxxx.xxx',
        	reader: {
    	    type: 'json',
    	    root: 'records'
    	}
        }
    });

    Comment


    • #3
      Ext 3 method:

      Code:
          var myStore = new Ext.data.JsonStore({
          	autoLoad: true,
          	root: 'xxx',
              proxy : new Ext.data.ScriptTagProxy({
                  url: 'http://xxxx.com/xxxx.xxx'
              }),
          	fields: ['firstname','lastname','id']
          });

      Comment


      • #4
        Thank You very much for your reply. It is MOST appreciated.

        I was using 3.4, I could never get it to work. I had to integrate jQuery into the script to get the x-domain to function at all ... I had to make a jsonp data type.

        Looks like Ive got to bite the bullet and migrate to 4.x. More all-night coffee benders ahead for me ...%-)
        Last edited by davisty; 09-16-2011, 08:43 AM.

        Comment

        Working...
        X