I am trying to create a form that submits data through jQuery and fills the return in the same DIV. Therefore, the page does not refresh after the action.
<div id="add_value_form"> <form method="POST" action="#" onsubmit='return false'> <input type="submit" value="Add" onclick='post_form("/add_value");'> </form> </div>
JS function:
function post_form(url) { $.post(url, {'test':'test'}, function(data) { $("#add_value_form").empty().append(data); }, "text"); }
This works fine in FF3, however it will only work in IE6 / 7.
The server confirms that mail requests come from IE, but it sometimes received message data.
Curiously, I decided to warn the data variable:
$.post(url, {'test':'test'}, function(data) {alert(data);}, "text");
Of course, FF3 prints the HTML return code each time, while IE6 / 7 will mostly print spaces, with random HTML return. I could not find anything on this issue, so what am I doing wrong?
Solved: I traced this with the HTTP redirect that I had in the request processing code. Thus, the function processing the POST request throws the redirect, and IE does not like it. At that time, I had complete mental constipation, and I really did not need a redirection.
The strange part, of course, is that this works in FF, and IE will sometimes work, and the redirect is in place.