I have an iframe
<iframe class="browser" scrolling="no" name="navigation"></iframe>
An when a specific event is fired a POST request is sent to a servlet
$.post("LoggerServlet", { sharedSessionId: $('#sharedSessionId').val(), level: $('#level').val(), goTo: this.href} );
Is it possible to target the POST response to the iframe?
P.S. I think is possible use a workaround, like create a hidden form, populate it dynamically and use submit() method, but I'd prefer a "jQuery-native" solution if is possible.
P.P.S.
I've also tried something like this
$.post("LoggerServlet", {
sharedSessionId: $('#sharedSessionId').val(), level: $('#level').val(), goTo: this.href
}).success(function(data) { alert(data); });
and
$.post("LoggerServlet", {
sharedSessionId: $('#sharedSessionId').val(), level: $('#level').val(), goTo: this.href},
function(data) { alert(data); });
and
$.post("LoggerServlet", {
sharedSessionId: $('#sharedSessionId').val(), level: $('#level').val(), goTo: this.href
}).success(function(data) {
var iframe = $(".browser")[0].contentWindow.document;
iframe.open();
iframe.empty(); //just to see if the callback is called
iframe.close();
});
});
and the result is the same: none :(
I have a doubt:
the response to post message (viewed by firebug) is an html page
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>[...]</body></html>
Are we sure that the data parameter in function(data) get this kind of response, and not only a Json-like response?
Some suggestion? Thanks to all.