Iframe form submit data to Window URL

replicaxTed

New Member
Suppose I type a URL in browser (http://localhost:8080/Proj/page) and I get a page where I have menu and an iframe. on click of menu I am doing an ajax request to the server by posting some data and getting an HTML document as response.I am manually updating the HTML document into iframe using javascript. {Reason behind this the URL has a query parameter and I want to POST it to the server and not GET,thus I am not changing iframe src}Ex:\[code\]<a href="http://stackoverflow.com/questions/14067757/#" onClick="frameopen('helloWOrld.html?a=bc&d=ef')">menu</a>;function frameopen(url) { var dataToSend = getQueryParameterFrmUrl(url);//got data in form of Object var urlWithoutQUeryParam = getUrlWithoutQueryParam(url);//got url without query parameter positionThrobber("section16_contentframe");//add the throbber //perform POST using ajax $.ajax({ url: urlWithoutQUeryParam, data: dataToSend, type: 'POST', success: function (serverResponse) { //server response came write this to iframe removeThrobber(); var ifrm = document.getElementById('contentframe'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write(serverResponse);//server response written ifrm.document.close(); }, error: function (jqXHR, textStatus, errorThrown) { removeThrobber(); alert("Ajax Request Failed!Text Status:" + textStatus + ",errorThrown:" + errorThrown); } });}\[/code\]Now the iframe is populated from server response and it contains a form.\[code\]<iframe src=""><html><body><form name="inboxSearchForm" id="inboxSearchForm" commandName="userQueueFilter" action="${pageContext.request.contextPath}/inbox/search" method="post"><a href="http://stackoverflow.com/questions/14067757/#" id="nextPage" onclick="pageJump(document.getElementById('pageNum').value,'up') ">Next ></a></form></body></html></iframe>\[/code\]There is a link(called Next) inside iframe which submit form using javascript\[code\]document.getElementById('inboxSearchForm').submit();\[/code\]THE problem is when I click on link Next..the iframe is loaded with URL content \[code\](http://localhost:8080/Proj/page\[/code\] ie iframe now store entire page ie menu and iframe and it is recursive..can anyone tell me what could be the reason..I want iframe to be refreshed from URL \[code\]/inbox/search\[/code\] and not from the URL in the browser..This behaviours is not getting reflected in IE facing issue in mozilla :(
 
Back
Top