I would like to perform a two stage post. The first is an AJAX post to my own service that creates form data such as "email=blah&dude=car" etc.
In the callback for the AJAX call I need to repost that data to a remote site, in a normal post.
I was thinking something like:
var formData = "some form data";
$.ajax({
type: 'POST',
url: '/myservice',
data: formData,
success: function(data, status) {
xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","http://remotepage.com",true);
xmlhttp.send(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
//display error message },
dataType: "text",
});
However, the httpRequest will fail due to XSS prevention on remotepage.com. How can I easily repost the processed form data to the remote URL?