0

For example i have script

$.getScript('http://jquery.com/files/social/js/jquery.tabs.js',function(data){console.log(data)})

In returns undefined, but if i load in this way:

$.getScript('/social/js/jquery.tabs.js',function(data){console.log(data)})

It will return me contents of my script. Is it possible to fix?

0

2 Answers 2

3

You are having a CrossDomain problem, you can not do ajax request to pages with different domains/ports. Check JSONP, jquery supports it to some extent: jQuery Documentation

Please take into account you might need to control or at least support from the server side depending on what you want to do.

Sign up to request clarification or add additional context in comments.

Comments

-2

Check out this site, they have given some real time example for JSONP Req

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.