Skip to content


Technical Difficulties

While working on the product for Intense Debate I recently ran into a little snafu. For those of you that don’t know this (which I didn’t until just recently), Ajax does not work across domains. In other words, a page on example.com can not send Ajax requests to another page at anothersite.com. Apparently this was done as a security precaution…which I don’t really understand since just about every other method of communication on the web works fine from one domain to another. It was definitely a set back for our project though….we rely quite heavily on Ajax (between domains) for our product to work.

Turns out there is a relatively simple (though not quite as nice) work around with a creative use of the script tag. Essentially, you use a newly created script tag that passes values inline in the url back to the remote server. The server then returns a script that calls whatever function would normally be called on a successful post of the traditional Ajax methods. It’s not quite as clean, and some browsers will virtually hang during the communication stage, but it allows dynamic background communication. In other words, it works.

This was definitely a potentially large setback. It would’ve all but meant the death of our product had we not found a functional workaround. And thus I wanted to write this post as a resource for those who might not already know this. Ajax does not work across domains. And the work around is a creative use of the script tag. Feel free to email me if you happen to need a little more in depth explanation of this technique. It really is rather simple though. Just wish someone would’ve told me…could’ve saved me a couple of hours of confusion and research as to why my application didn’t work.

Posted in General.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.


42 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Jon says

    New comment

  2. Jon says

    New comment

  3. Jon says

    New comment

  4. Jon says

    New comment

  5. Jon says

    New comment

  6. Jon says

    New comment

  7. Jon says

    New comment

  8. Jon says

    This comment system rocks!

  9. Jon says

    This comment system rocks!

  10. Jon says

    This comment system rocks!

  11. Jon says

    This comment system rocks!

  12. Jon says

    This comment system rocks!

  13. Jon says

    This comment system rocks!

  14. Jon says

    This comment system rocks!

  15. Jon says

    Heck yeah it does!

  16. Jon says

    Heck yeah it does!

  17. Jon says

    Heck yeah it does!

  18. Jon says

    Heck yeah it does!

  19. Jon says

    Heck yeah it does!

  20. Jon says

    Heck yeah it does!

  21. Jon says

    Heck yeah it does!

  22. Jon says

    Rockon!

  23. Jon says

    Rockon!

  24. Jon says

    Rockon!

  25. Jon says

    Rockon!

  26. Jon says

    Rockon!

  27. Jon says

    Rockon!

  28. Jon says

    Rockon!

  29. Jon says

    IE Sux

  30. Jon says

    IE Sux

  31. Jon says

    IE Sux

  32. Jon says

    IE Sux

  33. Jon says

    IE Sux

  34. Jon says

    IE Sux

  35. Jon says

    IE Sux

  36. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  37. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  38. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  39. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  40. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  41. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons

  42. Blandly Urbane says

    ID most definitely rocks, I agree with the Jons