Answer the question
In order to leave comments, you need to log in
How to save a file from a site as a picture?
I found a js script on the Internet, which makes it possible to fill out a template form, later save it as a picture.
// отправляем на рендеринг
$.ajax({
type: "POST",
url: $('form').attr('action'),
data: data
}).done(function(result) {
location.href = 'http://адрессайта/downloader.php?filename='+result;
})
.fail(function(msg){
//alert(msg);
console.log(msg);
});
Answer the question
In order to leave comments, you need to log in
Judging by the code, jQuery is used.
Your script sends data via an asynchronous HTTP GET request ( see the docs , the GET method is used by default) to the address specified in the form's HTML action attribute .
The response from the script that processed your request is placed in the result variable , and then passed to the response processing function, which redirects (redirects) the client browser to the downloader.php script
function(result) {
location.href = 'http://адрессайта/downloader.php?filename='+result;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question