File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes jquery - ajax call to another site and parse result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jquery - ajax call to another site and parse result" Watch "jquery - ajax call to another site and parse result" New topic
Author

jquery - ajax call to another site and parse result

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31065
    
232

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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

One way could be to override document.write. Is this the best approach ? I don't know !


[My Blog]
All roads lead to JavaRanch
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: May 26, 2003
Posts: 31065
    
232

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

Joined: May 26, 2003
Posts: 31065
    
232

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
 
subject: jquery - ajax call to another site and parse result