admin管理员组文章数量:1289986
In our application, we need to refresh the page. Now I am using the onclick()
event to call the below javascript method.
function refresh() {
document.getElementById('Question-Preview-ComboBox').style.display='none';
document.getElementById('Question-Preview-RelatedSRTicketDetails').style.display='none';
document.getElementById('Question-Preview-SignoffdetailControl').style.display='none';
document.getElementById('Question-Preview-RelatedTicketDetails').style.display='none';
document.getElementById('Question-Preview-PerformedBy').style.display='none';
document.getElementById('Question-Preview-TextBox').style.display='none';
document.getElementById('Question-Preview-CheckBoxMatrix').style.display='none';
document.getElementById('Question-Preview-Radio').style.display='none';
document.getElementById('Question-Preview-CheckBoxMatrixWOT').style.display='none';
document.getElementById('Question-Preview-MultiLineText').style.display='none';
if (windowDirty == true) {
showModal('doyouwanttosave');
}
else {
self.location = 'CreateQuestionnaireForm.html';
}
}
The above script will ask users before they refresh the page "Do you want to save" and will make a GET request to call the controller method to reload the page. But our requirement is to change the GET request to POST for the above same functionality. Please suggest how can I change a GET request to POST?
In our application, we need to refresh the page. Now I am using the onclick()
event to call the below javascript method.
function refresh() {
document.getElementById('Question-Preview-ComboBox').style.display='none';
document.getElementById('Question-Preview-RelatedSRTicketDetails').style.display='none';
document.getElementById('Question-Preview-SignoffdetailControl').style.display='none';
document.getElementById('Question-Preview-RelatedTicketDetails').style.display='none';
document.getElementById('Question-Preview-PerformedBy').style.display='none';
document.getElementById('Question-Preview-TextBox').style.display='none';
document.getElementById('Question-Preview-CheckBoxMatrix').style.display='none';
document.getElementById('Question-Preview-Radio').style.display='none';
document.getElementById('Question-Preview-CheckBoxMatrixWOT').style.display='none';
document.getElementById('Question-Preview-MultiLineText').style.display='none';
if (windowDirty == true) {
showModal('doyouwanttosave');
}
else {
self.location = 'CreateQuestionnaireForm.html';
}
}
The above script will ask users before they refresh the page "Do you want to save" and will make a GET request to call the controller method to reload the page. But our requirement is to change the GET request to POST for the above same functionality. Please suggest how can I change a GET request to POST?
Share Improve this question edited Dec 5, 2011 at 12:22 Crab Bucket 6,2779 gold badges41 silver badges73 bronze badges asked Dec 5, 2011 at 12:15 ChanduChandu 751 gold badge3 silver badges11 bronze badges 03 Answers
Reset to default 6You will need to create a hidden form, add it to the document and then submit it by calling the .submit()
on the form's DOM object.
Include the form tag and specify the action method as post
<form action="destination_url" METHOD=Post>
....
<input type=submit value="Submit" />
</form>
you need to create a form and submit it - than you'll have post request.
本文标签: javascriptPage refresh with post requestStack Overflow
版权声明:本文标题:javascript - Page refresh with post request - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741433834a2378518.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论