Forum Moderators: open
DOMAIN 1 - I have a web application that returns the following dynamic html (please note that there are no other html tags such as <body>, etc. generated):
<table>
<tr><td>some db data</td></tr>
<tr><td>some db data</td></tr>
</table>
DOMAIN 2 - This domain is a static html website that I'd like to insert the table above into:
<html>
...
<div id="MyID">Insert html table from other domain here.</div>
...
</html>
I have some more questions about this but will wait until I know if AJAX is required to do this.
Thank you!
I also found threads talking about AJAX libraries, but for my requirements, I don't think I need such large AJAX suites.
Pretty much, I just want to insert text from one URL into a div.
Is there a small routine or lib available that someone can recommend for this? I really don't need to do any fancy AJAX stuff on my page.
Thank you
I usually don't suggest anyone to use a framework, but since you're new to AJAX, please take a look on the following page: [docs.jquery.com...] (load( url, [data], [callback] ))
Explanation of why i suggest now a framework for ajax: simply because it's way easier than creating the crossbrowser functions which can make XHR.
XHR = XMLHttpRequest aka(-ish) AJAX
I studied up on using XMLHttpRequest and it actually seems to be much easier than I had envisioned it to be. Like you suggested, I'm going to begin working without an AJAX framework for now. Alternatively, I can see how useful a framework would be when changing the appearance of your page (i.e. widgets, animation...).
Thank you
Try to understand the examples, then when you think you understand, try to grab the snippets from their pages and put them in your own code. It's easier than making IE crash, so, have a great fun :)
[edit]W3C and w3 is not the same i guess :¦
To clarify you want to take
example.com/example.xml
and put it into this page using Ajax?
example2.com/example.html
If so you can't do this with Ajax, part of the built in security with XMLHttpRequest is that you can't request data from a different domain.
Perhaps I have misunderstood your question but if you are using 2 seperate domains then maybe an iFrame is the way to go.
[edited by: Demaestro at 9:42 pm (utc) on Jan. 9, 2009]