Current location - Quotes Website - Personality signature - How does js in html get the parameters passed through POST method
How does js in html get the parameters passed through POST method
You can get the parameters by parsing the url path:

\ tfunctiongetURLParameter(name){

returndecodeURIComponent((new regexp([? | & amp]'+name+'='+'([^&; ; ]+? )(& amp|#|; |$)').exec(location.search)||[," "])[ 1]。 replace(/\+/g,' % 20 ')| | null;

\t}

\ tvar orgid = getURLParameter(' orgid ');

\ tvarorglevel = getURLParameter(' org level ');

\ t console . log(' orgid = '+orgid);

\ t console . log(' org level = '+org level);

Extended data

Pass parameters and get parameters through url address in html:

varurl = document . location . tostring(); //get url address

varurlParmStr = URL . slice(URL . index of('?' ))+ 1); //Get all strings after the question mark.

vararr = urlparmstr . split(' & amp;' )); //Pass &; Symbol splits a string into an array.

varcourseId=arr[0]。 split(" = "[ 1]; //Get the first parameter in the array

varunit_title=arr[ 1]。 split(" = "[ 1]; //The second parameter

unit _ title = decode uri(unit _ title); //transcoding changes the decoding mode unscape to decodeURI to obtain Chinese parameters.

console . log(unit _ title);