I have a TEST.ASP with this code:
<HTML>
<HEAD>
    <SCRIPT src="ajaxScript.js" type="text/javascript"></SCRIPT>
</HEAD>
<BODY>
    <FORM action="action_page.asp" method="post">
        First Name:<BR>
        <INPUT type="text" name="FName"><BR>
        Last Name:<BR>
        <INPUT type="text" name="LName"><BR>
        <INPUT type="submit" value="Submit">
        <BUTTON type="button" onClick="loadXMLDoc('action_page.asp',this.form);">GoGoGo!</BUTTON>
    </FORM>
    <DIV id="msgBoxDiv">TEST!!</DIV>
</BODY>
</HTML>
The Javascript file that is called (ajaxScript.js) has this code:
var req; // global variable to hold request object
function processReqChange()
{
    if (req.readyState == 4 && req.status == 200){document.getElementById("msgBoxDiv").innerHTML = req.responseText;}
}
function loadXMLDoc(url, params)
{
    if(window.XMLHttpRequest)
    {
        try
        {
            req = new XMLHttpRequest();
        } catch(e)
            {
                req = false;
            }
    }
    else
    {
        req = false;
    }
    if(req)
    {
        var formData = new FormData(params);
        req.onreadystatechange = processReqChange;
        req.open("POST", url, true);
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        req.send(formData);
        return true;
    }
    return false;
}
And my "action_page.asp" to receive the parameters is like so:
<%
    vRF1 = request.Form("FName")
    vRF2 = request.Form("LName")
%>
<HTML>
    <HEAD>
    </HEAD>
    <BODY>
        First:<%=vRF1%><BR>
        Last:<%=vRF2%>
    </BODY>
</HTML>
If I make the normal submit (submit button), everything goes as expected: it shows a new page with the values of the form.
BUT... if I try to read the target ASP with AJAX (gogogo button), I can't send the form to the target page. I do receive the target page, but without the supposed values.
I get this:
Result page
If I change "req.send(formData);" for " req.send("FName="+1+"&LName=QWER");", everything works well.
I've read that to send the entire form (like the "usual" post do), I just need to make "var formData = new FormData(params);" where params would be the form object, and then send the FormData(params).
What may I be doing wrong here?