using this code in the drupal block:

<script type="text/javascript">

but it won't load content from domain nashmir.kz. With local files it works well. Can somebody throw me a working example on how to load content from another domain?

  • Which version of Drupal are you using and which format type have you choose when you added this code to a block ? – yvan Sep 21 '11 at 9:22
  • Ofcourse PHP, drupal version is 6.22 – Alexander Kim Sep 21 '11 at 9:56

You can use a local PHP script to pull the external data. Then use AJAX to show it in a block.

      // ajax call to a php script
        { "post_parameter" : "post_value" },
          // put the result into a div

Then again if you only want to display an external website, you can use an <iframe>.


Cross domain can not be invoked with .load(). It's a security problem. Ajax cross domain is XSS. http://en.wikipedia.org/wiki/Same_origin_policy If the other site has some scripts, it can mess with your page basically.

What you need is jsonp or cors https://developer.mozilla.org/en/HTTP_access_control

cheers T

  • can you throw me an example? – Alexander Kim Sep 21 '11 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.