I browse the answer for this question, but haven't find a good answer for me yet.
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
if(request.readyState == 4 && request.status == 200){
var response = response.responseText;
window.open(response, "_blank", "location = 0, menubar = 0");
}
}
request.open("POST", "http://localhost/save.php", true)
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send("imag="+data);
the above is my javascript code. I did use http:// instead of file://, and I did put the files on XAMPP server. I also use header('Access-Control-Allow-Origin: *') in my save.php as someone mentioned, but I still get the same error.
Some help please...
I finally get it. When they say using http to open the file, they mean 2 things.
Silly mistakes...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.