<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>http://wiki.enunpimpam.com/pimpamwiki/index.php?action=history&amp;feed=atom&amp;title=Traer_datos_con_fetch</id>
	<title>Traer datos con fetch - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.enunpimpam.com/pimpamwiki/index.php?action=history&amp;feed=atom&amp;title=Traer_datos_con_fetch"/>
	<link rel="alternate" type="text/html" href="http://wiki.enunpimpam.com/pimpamwiki/index.php?title=Traer_datos_con_fetch&amp;action=history"/>
	<updated>2026-04-05T23:59:10Z</updated>
	<subtitle>Historial de revisiones de esta página en el wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://wiki.enunpimpam.com/pimpamwiki/index.php?title=Traer_datos_con_fetch&amp;diff=1030&amp;oldid=prev</id>
		<title>Nacho: Página creada con «Categoría: JavaScript &lt;syntaxhighlight lang=&quot;js&quot;&gt;  fetch(&quot;https://randomuser.me/api/&quot;)   .then(function(response) {     // console.log(response)     return response.js…»</title>
		<link rel="alternate" type="text/html" href="http://wiki.enunpimpam.com/pimpamwiki/index.php?title=Traer_datos_con_fetch&amp;diff=1030&amp;oldid=prev"/>
		<updated>2020-08-11T16:50:31Z</updated>

		<summary type="html">&lt;p&gt;Página creada con «&lt;a href=&quot;/pimpamwiki/index.php/Categor%C3%ADa:JavaScript&quot; title=&quot;Categoría:JavaScript&quot;&gt;Categoría: JavaScript&lt;/a&gt; &amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;  fetch(&amp;quot;https://randomuser.me/api/&amp;quot;)   .then(function(response) {     // console.log(response)     return response.js…»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Categoría: JavaScript]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt; &lt;br /&gt;
fetch(&amp;quot;https://randomuser.me/api/&amp;quot;)&lt;br /&gt;
  .then(function(response) {&lt;br /&gt;
    // console.log(response)&lt;br /&gt;
    return response.json()&lt;br /&gt;
  })&lt;br /&gt;
  .then(function (Usuario){&lt;br /&gt;
    console.log('Todo los datos en Array', Usuario)&lt;br /&gt;
    console.log('Solo el Nombre:', Usuario.results[0].name.first)&lt;br /&gt;
  })&lt;br /&gt;
  .catch(function(response) {&lt;br /&gt;
  })&lt;br /&gt;
 })&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Funciones asincronas==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt; &lt;br /&gt;
  (async function load(){&lt;br /&gt;
    // await&lt;br /&gt;
    const respuesta = await fetch(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=action&amp;quot;)&lt;br /&gt;
    const datos = await respuesta.json()&lt;br /&gt;
    console.log(datos)&lt;br /&gt;
  })()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Petición de una lista de 50 peliculas de Sci-ficción&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt; &lt;br /&gt;
 (async function load(){&lt;br /&gt;
    // await&lt;br /&gt;
    //action, sci-fi, animation, fantasy&lt;br /&gt;
    async function getDatos(url) {&lt;br /&gt;
      const respuesta = await fetch(url)&lt;br /&gt;
      const datos = await respuesta.json()&lt;br /&gt;
      return datos&lt;br /&gt;
    }&lt;br /&gt;
    const scifiList = await getDatos(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=sci-fi&amp;amp;limit=50&amp;quot;)&lt;br /&gt;
    console.log('scifiList', scifiList)&lt;br /&gt;
  })()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Petición de lista de 50 películas de cuatro géneros diferentes.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt; &lt;br /&gt;
  (async function load(){&lt;br /&gt;
    // await&lt;br /&gt;
    //action, sci-fi, animation, fantasy&lt;br /&gt;
    async function getDatos(url) {&lt;br /&gt;
      const respuesta = await fetch(url)&lt;br /&gt;
      const datos = await respuesta.json()&lt;br /&gt;
      return datos;&lt;br /&gt;
    }&lt;br /&gt;
    const scifiList = await getDatos(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=sci-fi&amp;amp;limit=50&amp;quot;);&lt;br /&gt;
    const actionList = await getDatos(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=action&amp;amp;limit=50&amp;quot;);&lt;br /&gt;
    const animationList = await getDatos(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=animation&amp;amp;limit=50&amp;quot;);&lt;br /&gt;
    const fantasyList = await getDatos(&amp;quot;https://yts.mx/api/v2/list_movies.json?genre=fantasy&amp;amp;limit=50&amp;quot;)&lt;br /&gt;
    console.log('Sci-fi',scifiList);&lt;br /&gt;
    console.log('Acción',actionList);&lt;br /&gt;
    console.log('Animación',animationList);&lt;br /&gt;
    console.log('Fantasia', fantasyList);&lt;br /&gt;
  })()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nacho</name></author>
		
	</entry>
</feed>