Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



Posted on 2014-11-10
Medium Priority
Last Modified: 2014-11-26
Need help loading data when the URL contains the callback

myURL = '';

   type: 'GET',
    url: myURL,
    async: false,
    jsonpCallback: 'eqfeed_callback',
    contentType: "application/json",
    dataType: 'jsonp',
    success: function(data) {
    error: function(e) {

Open in new window

Question by:lvmllc
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 82

Accepted Solution

leakim971 earned 2000 total points
ID: 40434261
test page :

function eqfeed_callback(data) {
    for(var i=0;i<data.features.length;i++) {
var myURL = '';

var s = document.createElement("script");
s.type = "text/javascript";
s.src = myURL;

Open in new window


Author Comment

ID: 40435451
So if it works to build this with jQuery, why is it that when copying the URL to a script tag in the head from the start it fails?
LVL 82

Expert Comment

ID: 40435565
not sure you got it.
without jQuery it work (my test page)
using jQuery.ajax, jQuery.getJSON, jQuery.getScrip or any other jQuery fail

Author Comment

ID: 40457440
Sorry for not getting back to this sooner.
Just confirming if the result had been a simple file of data starting out with  eqfeed_callback({"type":"FeatureCollection","metadata" ...  then I could have just used a <script src="myscripts.js"></script>  in the head. But since this is a call to a file that is being generated I need the let the script know to read the result as JavaScript - thus    s.type = "text/javascript";

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The most up-to-date version of this article is on my Blog
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question