Answer the question
In order to leave comments, you need to log in
How to send form data to multiple scripts?
It is necessary to send data from the form to two scripts:
1) a script on the server that saves information in the database;
2) a script on a third-party site to which there is no access and to which, in fact, a redirect is needed.
Let me give you a real example: before sending the data to the Yandex script, you need to save the order data in the admin panel. Attempts to send data to Yandex with a post-request were unsuccessful, since a redirect is needed.
Any ideas? I heard something about Ajax, started reading a tutorial about JS. But just in case, I decided to ask, what if I complicate it and there is an easier way.
Answer the question
In order to leave comments, you need to log in
$('#buttonID').on('click', function(){
var url = "your_view_url";
$.ajax({
type: "POST",
url: url,
data: $("form").serialize()
});
return '';
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question