ElectroSoft
ElectroSoft
Reputation Top 5%
William Guevara
1 Snippet  (344th place)
Published
0 Channels
Created
3 Channels
Following
Aug 20, 2017
Last Visit
Nov 24, 2016
Registered
61 points  (394th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Popular Coder
Junior Autobiographer
Serious Autobiographer
Senior Autobiographer
Master Autobiographer

Recent Snippets See all snippets by ElectroSoft

public by ElectroSoft created Jul 15, 2017  156  0  4  0

Prueba de Ajax

Prueba de Axaj en javascript nativo.
function ajax()
{
    var elements = document.getElementsByClassName("formVal");
    var formData = new FormData(); 
    for(var i=0; i<elements.length; i++)
    {
        formData.append(elements[i].name, elements[i].value);
    }
    var xmlHttp = new XMLHttpRequest();
        xmlHttp.onreadystatechange = function()
        {
            if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
            {
                alert(xmlHttp.responseText);
            }
        }
        xmlHttp.open("post", "prueba.php"); 
        xmlHttp.send(formData); 
}
;