Created
December 10, 2015 02:24
-
-
Save edinsoncs/47247bcf7d9473c5397e to your computer and use it in GitHub Desktop.
Api Url Json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>JsonWeb</title> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
</head> | |
<body> | |
<section id="content"> | |
<form class="json"> | |
<input type="text" class='to'> | |
<input type="submit" placeholder="json"> | |
</form> | |
</section> | |
<script> | |
/*function createElement(element, text) { | |
var create = element; | |
var create_Two = document.createElement(create); | |
var textCreate = text; | |
var textCreate_Two = document.createTextNode(textCreate); | |
var a = create_Two.appendChild(textCreate_Two); | |
if(a.length === 0 || a.length <= 2) { | |
return "Error"; | |
} | |
else { | |
return console.log('Acceso Permitido'); | |
var toAdd = document.getElementById("content"); | |
document.body.insertBefore(create_Two, toAdd); | |
} | |
} | |
createElement('h1', 'Ingresa url');*/ | |
(function(){ | |
$(".json").submit(function(e){ | |
e.preventDefault(); | |
var obj = {}; | |
var URL = $('.to').val(); | |
var API = "http://query.yahooapis.com/v1/public/yql?q="; | |
var API_BUSQUEDA = encodeURIComponent('select * from html where url="'+URL+'"'); | |
var API_FORMAT = "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" | |
$.getJSON(API+API_BUSQUEDA+API_FORMAT, laF, false); | |
function laF(data) { | |
var a = JSON.stringify(data); | |
document.write(a); | |
} | |
}); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment