This cannot be done without an iFrame. iFrames are specifically built to load pages. ajax
cannot be used for content-injection from cross domains. There are many alternatives/fixes to rectify this :
- As the previous answer has recommended, set the
url
attribute of the iframe to the target page and be done with it. - If the url isnt dynamic, just set the
src
attribute within the HTML itself. No jQuery would be needed then. - You could use
jsop
ifcors
is supported by the server on whichxyz.com
is hosted on. - If you're still insistent on using
ajax
and jquery for this, use this extra mod to theajax
library : http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/ - There's one last (and more complicated) way to achive this. You could send a request to your server and make the server talk to the url and then make your server return it to you. You could use
ajax
to get that out.
Please look at these links for more clarity on this :