Ajax JSONP vs Ajax JSON (v9)

Revision 9 of this benchmark created on


Description

Ajax JSONP vs Ajax JSON

Preparation HTML

<div id="content">
</div>

Setup

function callback(data) {
      document.getElementById('content').innerHTML = data;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Ajax JSONP
var a = document.createElement('SCRIPT');
a.async = true;
a.src = 'http://jsperf.com/api/jsonp';
ready
Ajax JSON
var a = new XMLHttpRequest;
a.open('GET', 'http://jsperf.com/api/json', true);
a.onreadystatechange = function () {
  if (4 == a.readyState && 200 == a.status) {
    callback(a.responseText);
  }
}
a.send();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.