I was implementing my code from this answer to do Ajax calls in webkit on a form upload and it works well. https://stackoverflow.com/a/16200886/548558
My backend gives me a redirect if the form is valid but the redirect is happen in the iframe but I really want to have it the normal window. How I can do this? Anybody has an idea?
CODE
$(function() {
$('#upload-form').submit(function() {
// Prevent multiple submits
if ($.data(this, 'submitted')) return false;
$(this).prop("target", "file-upload");
// Update progress bar
function update_progress_info() {
// $progress.show();
$.getJSON(progress_url, {'X-Progress-ID': uuid}, function(data, status) {
if (data) {
var progress = parseInt(data.uploaded) / parseInt(data.length);
var width = $progress.find('.progress-container').width()
var progress_width = width * progress;
$progress.find('.progress-bar').width(progress_width);
$progress.find('.progress-info').text('uploading ' + parseInt(progress*100) + '%');
console.log("progress")
console.log(progress)
window.setTimeout(update_progress_info, freq);
}
});
};
window.setTimeout(update_progress_info, freq);
$.data(this, 'submitted', true); // mark form as submitted
});
});
If your call, if I understood your question, is made into an
iframe
, you must go to yourwindow
component, call to his parent (the container of thisiframe
) and call his methodslocation
andhref
. I had to use this a few time ago and worked for me.window.parent.location.href = "/foo.html"