Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

CANNOT get a cross-domain script via $.ajax({ type: 'script'}). #607

Closed
LeoYuan opened this issue Mar 10, 2014 · 2 comments
Closed

CANNOT get a cross-domain script via $.ajax({ type: 'script'}). #607

LeoYuan opened this issue Mar 10, 2014 · 2 comments

Comments

@LeoYuan
Copy link
Contributor

LeoYuan commented Mar 10, 2014

bug description

you will get an cross-domain error when using $.ajax({type: 'script'}) to get script, 'cause the code always create a XHR object to send requests.

how to reproduce?

af.ajax({
      url: 'https://ehr.alibaba-inc.com/assets/masterdata/employee/lib/lodash.min.js',
      dataType: 'script',
      success: function() {
             console.log('loaded');
      }
})

how to fix?

create a script tag to load script.

@lenichols
Copy link

dealing with this same issue...

@imaffett
Copy link
Contributor

imaffett commented Nov 5, 2014

@lenichols Saying "I'm dealing with this same issue" isn't helpful"

It should work though. There is a shorthand helper that just wraps around it

https://github.com/01org/appframework/blob/master/appframework.js#L1973

@imaffett imaffett closed this as completed Nov 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants