Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open("GET", $urlEnvio, false);
- xmlhttp.setRequestHeader("accept" ,"application/json");
- xmlhttp.setRequestHeader("content-type" ,"application/json");
- xmlhttp.send($urlEnvio);
- var resultado = xmlhttp.response;
- var elementos =JSON.parse(resultado);
- axios.get(urlEnvio, usuario, clave)
- .then(response => {
- // JSON responses are automatically parsed.
- this.posts = response.data
- //var elementos = JSON.stringify(posts);
- alert(posts[0]);
- })
- var elementos = [];
- axios.get(urlEnvio, usuario, clave)
- .then(response => {
- // JSON responses are automatically parsed.
- elementos = response.data;
- });
- var elementos = [];
- axios.get(urlEnvio, , {
- params: {
- user: usuario,
- pass: clave
- }
- })
- .then(response => {
- // JSON responses are automatically parsed.
- elementos = response.data;
- });
- $response = [];
- $response['logged'] = false;
- if($_GET['user']=="oxxido" && $_GET['pass']=="superseguro") {
- $response['logged'] = true;
- }
- echo json_encode($response);
- // GET request
- axios.get('https://api.github.com/users/oxxido')
- .then(function(response){
- console.log(response.data); // ex.: { user: 'Your User'}
- console.log(response.status); // ex.: 200
- });
- // guardando POST request
- axios.post('/save', { firstName: 'Oxxido', lastName: 'Test' })
- .then(function(response){
- console.log('Guardado exitoso')
- });
Add Comment
Please, Sign In to add comment