ElectroSoft
ElectroSoft
Reputation Top 5%
William Guevara
1 Snippet  (313rd place)
Published
0 Channels
Created
3 Channels
Following
May 19, 2018
Last Visit
Nov 24, 2016
Registered
61 points  (430th 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  256  0  5  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); 
}
;