I wrote a javascript that loads a webpage from a web application using Jquery.post. I display the page in iframe . The webpage gets displayed in IE but not in firefox. I tried using Firebug but there is no error , it has a 302 OK note. I tried changing the Jquery source that also did not work. Tried JSON that also did not work. Its more than 3 days i am trying to fix this issue. I tried lot of methods but it was not fruitful.
<html>
<head>
<script type="text/javascript"src="http://ajax.microsoft.com/ajax/jquery/jquery1.4.2.min.js">
</script>
<script type="text/javascript">
function callajax()
{
var iframe =document.createElement("iframe");
iframe.style.width="100%";
iframe.style.height="100%";
//app.getContentEl().appendChild(iframe);
document.body.appendChild(iframe);
jQuery.post('http://localhost:9090/simpleapp/formproc1', {'param':'rajat'},function(html){
var doc =iframe.contentWindow.document;
doc.write(html);
doc.close();
});
}
</script>
</head>
<body>
<p>Start typing a name in the input field below:</p>
<span></span>
<div id="display"></div>
First name:
<input type="text" />
<button onclick="callajax()">Click me</button>
</body>
</html>
i will also enclose the post method since it might also be an erroneous one.
doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out = response.getWriter();
String par = request.getParameter("param");
System.out.print("Hiii this is inside POST method");
//out.println("<data><param>"+par+"</param></data>");
//out.println(par);
//out.flush();
//System.out.print(par);
response.sendRedirect("first.jsp");
// out.println("{\"redirect\":\"first.jsp\"}");
}