0
In an HTML have for example:
<fieldset>
<div>
<h3 class="title title-line">Dados da conta</h3>
</div>
<div class="ch-form-row">
<label>Usuário</label>
<span>MEU-USUARIO</span>
<a class="smalla" href="https://myaccount.mercadolivre.com.br/profile/changeNickName">Modificar</a>
</div>
<div class="ch-form-row">
<label>E-mail</label>
<span>[email protected]</span>
<a class="smalla" href="https://myaccount.mercadolivre.com.br/profile/changeEmail">Modificar</a>
</div>
<div class="ch-form-row">
<label>Senha</label>
<span>**********</span>
<a class="smalla" href="https://accountrecovery.mercadolivre.com.br/accountrecovery/changePassword">Modificar</a>
</div>
</fieldset>
I need Another page to capture the Username and save to a variable, as close as I can reach with jQuery Load()
was:
$( "#id-de-teste" ).load("https://myaccount.mercadolivre.com.br/profile .ch-form-row span:first", function(data, status){
username = $('#retorno_webtracker').html();
alert(username);
});
However I had 2 problems: The variable with the Username also got the tags <span>
, and I don’t want/need this value to be displayed on the page, I just need it in the variable to proceed with the script routine.
With jQuery Get()
can "download" the page with the data I need, however I am not able to filter only the class . ch-form-Row after the first tag
$.get("https://myaccount.mercadolivre.com.br/profile", function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
//username = $('span',$('.ch-form-row')).html();
filtro = data.getElementsByClassName('ch-form-row');
console.log( filtro );
});