1

我不太了解ajax,但有以下功能:

function saveViaAJAX() {  
    var canvasData = $("#wPaint").wPaint("image");
    var postData = "canvasData="+canvasData;

    var ajax = new XMLHttpRequest();
    ajax.open("POST",'testSave.php',true);    
    ajax.setRequestHeader('Content-Type', 'canvas/upload');

    ajax.onreadystatechange=function() {
        if (ajax.readyState == 4) { 
            document.getElementById("debugFilenameConsole").innerHTML="Saved as<br><a target='_blank' href='"+ajax.responseText+"'>"+ajax.responseText+" </a><br>Reload this page to generate new image or click the filename to open the image file in a new window.";
        }
     }

    ajax.send(postData);  
}

这工作正常,但我有另一个变量我想传递给 testSave.php

<select id="website_string" name="website_string"> 
    <option value="" selected="selected"></option>
    <option value="A4">A4</option>
    <option value="A5">A5</option>
</select>

我试图在同一个函数中传递它,但我认为它是 ("Content-type", "application/x-www-form-urlencoded")。

4

0 回答 0