Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.getJSON('/my/url', function(data) {
- console.log(data);
- });
- request = new XMLHttpRequest();
- request.open('GET', '/my/url', true);
- request.onload = function() {
- if (request.status >= 200 && request.status < 400){
- // Success!
- data = JSON.parse(request.responseText);
- console.log(data);
- } else {
- // We reached our target server, but it returned an error
- }
- };
- request.onerror = function() {
- // There was a connection error of some sort
- };
- request.send();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement