This question already exists in the OS in English, but to facilitate your understanding I will give a translated
On the page where the iframe will appear:
function myFunction(){
$('#meuIframe').attr('src', "meuIframe.html?param1=value1¶m2=value2");
}
Inside of your iframe:
function getParamValue(paramName) {
var url = window.location.search.substring(1); // Pega as variaveis na url
var qArray = url.split('&'); // pega os pares de chave e valores
for (var i = 0; i < qArray.length; i++) {
var pArr = qArray[i].split('='); // Separa a Chave do Valor
if (pArr[0] == paramName)
return pArr[1]; // Retorna o Valor
}
}
If you want to take a specific parameter use:
var param1 = getParamValue('param1');
Link to Original post
Credits: Ozgur Bar
var param1 = getParamValue('param1'); should I put in js and specify the variable I want to send? and this:: Function myFunction(){ $('#meuIframe'). attr('src', "meuIframe.html?param1=value1¶m2=value2");?
– Mateus Nobre