The X in AJAX
responseXML
propertygetElementsByTagName
) and properties (e.g. childNode
, nodeValue
, etc.)responseText
propertyinnerHTML
innerHTML
propertyvar person = function() {
this.name = "Jeremy Keith";
this.website = "http://adactio.com/";
this.email = "jeremy@adactio.com";
};
{"person" : {
"name" : "Jeremy Keith",
"website" : "http://adactio.com/",
"email" : "jeremy@adactio.com"
}
}
eval
eval()
so the source must be trustworthyopen
method must be the same domain.script
element can be hosted on a different domain.src
attribute of a <script>
tag, pointing it to a resource that returns JSON.Choose the best format for the job.
<script>
tag hack) is the only option.innerHTML
to insert a fragment of HTML