Reply
Dynamic height of external content using Ajax script?
Old 01-09-2009, 04:22 AM Dynamic height of external content using Ajax script?
Novice Talker

Posts: 5
Hi guys,
We need to load an external page (from another domain) into ours. The problem is that the height cannot be adjusted according to the height of the external content. First I tried using an iframe, but the height wouldn't adjust. Then I was told that I could load the content in a div using an Ajax script. I was given this example:
Code:
<script type="text/javascript">
                   new Ajax.PeriodicalUpdater('external', 'http://www.external.com/content.php', {
                              method: 'get', frequency: 30, decay: 3
                            });
                        </script>. 
<div name="external">here comes the content</div>
Anyone knows how to complete the code?
I have no experience with Ajax scripts.

Your help is appreciated.

Kind regards
Henrik

Last edited by chrisper : 01-09-2009 at 04:24 AM.
chrisper is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-09-2009, 08:35 AM Re: Dynamic height of external content using Ajax script?
chrishirst's Avatar
Super Moderator

Posts: 19,022
Location: Blackpool. UK
You cannot load a page from a different domain with javascript.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-09-2009, 09:16 AM Re: Dynamic height of external content using Ajax script?
Novice Talker

Posts: 5
Then how is this possible:

Code:
 
<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 600;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
This is from Googles Custom Search Engine where you can display the search results on a page of your own.

As far as I can see this looks very much like a Javascript. And Google aren't hosted at the same place as we are
Anyone knows how it's done?
chrisper is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 10:54 AM Re: Dynamic height of external content using Ajax script?
chrishirst's Avatar
Super Moderator

Posts: 19,022
Location: Blackpool. UK
Google's custom search, adsense etc calls a remote script into action, which gets the data from google.com and displays it on the page where the script is called.

Your script is trying to get data from a remote host, which is blocked as a XSS (Cross Site Scripting) attempt.

you need to get the AJAX script to get the remote page using whatever server side code you can run.
So you call a local code page, that then gets the remote data
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Dynamic height of external content using Ajax script?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.09174 seconds with 12 queries