In some cases we have a requirement, to POST data i.e. you’re accessing the URL can’t see the parameters passed, as some information might be sensitive so we can’t pass POST parameters in URL, but there is an alternative way to post parameters. Let’s see the Example – The below method is an alternative to Window.open or Window.location.href , if you want to POST the parameters. JavaScript Method:- var openPost = function (url, params) { var formElement = document.createElement( "form" ); formElement.setAttribute( "method" , "post" ); formElement.setAttribute( "action" , url); formElement.setAttribute( "target" , "_parent" ); for (param in params) { var hiddenField = document.createElement( "input" ); hiddenField.setAttribute( "name" , param); ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers