This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jquery - ajax call to another site and parse result

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to link to JavaBlackBelt as described here. They provide a URL that returns JavaScript that writes to the document.

This code works fine.


However, it slows down the page. I wanted to do something asynchronously so it wouldn't interfere with the page. The jbbURL returns code that writes to the document. I can't just call the function because it reloads the page with just the image. I was thinking I could store the results of the webpage and parse it. That gives an error. (but no message.) I guess this isn't allowed?




Am I doing something wrong? Any other ideas for what I am trying to accomplish?
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way could be to override document.write. Is this the best approach ? I don't know !
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript has a same origin policy, you can not make Ajax calls to another domain. Well you can, with CORS, but we are not going there.

If the code has document.write, you basically can not do anything with it to load it after the page has loaded.

Eric

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric: Right. I forgot about that. The workaround is to call a URL on our server that calls the java black belt server's URL and translates the result.

Christophe: That's a really interesting approach, but it scares me with side effects.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm overcomplicating this. It was just pointed out to me that I should be using an iframe rather than AJAX.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic