File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading a jsp page in a popup loaded in another domain

 
Rekha Pai
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am creating a jquery popup on an html page in say domain A.
I want to load a jsp page belonging to domain B. How can I do that.

I am giving below sample code I tried, but while running it gives
"xml can not be the whole program"

Can anybody help?

Regards,
Rekha.

Code I used :

<script src="./development-bundle/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" media="all" href="./development-bundle/js/jquery.popup.css" />
<script src="./development-bundle/js/jquery.popup.js" type="text/javascript"></script>

$.ajax({
url: "http://A.com/apps/InfoMgmt/secure/index_new.jsp",
dataType: 'jsonp',
// data: 'xml',
success: true
});

$(document).ready(function(){
//define config object
var dialogOpts = {
modal: true,
bgiframe: true,
autoOpen: false,
height: 500,
width: 500,
draggable: true,
resizeable: true,
open: function() {

$.getJSON("http://A.com/apps/InfoMgmt/secure/index_new.jsp",
function(data){
$.each(data.items, function(i,item){
$("").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});
$.get(
"http://www.google.com",
"{key:value}",
function(data) { alert(data); },
"html"
);
$.post("message.html", { func: "getNameAndTime" },
function(data){
alert("Hello");
}, "json");
// getUrl();
}
}


$("#example").dialog(dialogOpts); //end dialog
$("#example").dialog("open");

});
</script>
<script>

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same origin policy means you can not get content from another domain. SO you can not fetch an html doc from another domain.

JSONP expects a JSON object wrapped in a function to be returned. Is that what is being returned?

When you post code, use code tags/

Eric
 
Rekha Pai
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

But the two domains belong to our intraweb.
Is there any way for me to pop up some alerts
depending on some data ( say passport expiry
alerts) in cross domain?

Regards,
Rekha.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rekha Pai wrote:Hi,

But the two domains belong to our intraweb.
Is there any way for me to pop up some alerts
depending on some data ( say passport expiry
alerts) in cross domain?

Regards,
Rekha.


No, browser has no clue they are both your sites. If you are using modern day browsers, you can look at CORS.

You should either use a proxy or an iframe.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic