I have a textarea that accepts a bunch of data. I then submit it via $.ajax to a PHP script that processes it and generates a KML.
var pData = $("textarea#data").serialize();
$.ajax(
{
type: "POST",
url: "tools.php?mode=process",
data: pData,
success: function(data)
{
window.location.href = "tools.php?mode=download&"+pData;
});
});
This did work fine, until I started getting more and more data. Now I get a URI Too Large error, and am trying to find an alternative to force a file download. I tried using $.post() as well, but I can’t force it to download.
Following up the discussion in the comments, the optimal workflow for this might be
mode=processthrough Ajax andPOST;location.hrefcall goes tomode=downloadand the name of the temporary file