0

I want to load in a local page , only the elements LOGIN , PASSWORD , REGISTER , another external page in another domain, without loading the entire layout of it , only these three elements.

I've tried that way , seeking to identify the element:

$.ajax({
    url: 'http://www.sptrans.com.br/sac/solicitacoes.aspx',
    type: 'GET',
    success: function(res) {
        var headline = $(res.responseText).find('vUSRLOGA'); 
        $("#conteudo").html(headline);
    }
}); 

and

$.ajax({
            url: 'http://www.sptrans.com.br/sac/solicitacoes.aspx',
            type: 'GET',
            success: function(res) {
                var headline = $(res.responseText).text();
                $("#conteudo").html(headline);
            }
        })

I want the elements normally be presented in order to give login or register .

the current way , behind only the text of the page and not the functional elements

Full Code:

<!DOCTYPE HTML>
<html lang="pt-br">

<head>
<!-- Scripts Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://projetos.lucaspeperaio.com.br/ajax-cross-domain/jquery.xdomainajax.js"></script>

<script type="text/javascript">
/*$.ajax({
            url: 'http://www.sptrans.com.br/sac/solicitacoes.aspx',
            type: 'GET',
            success: function(res) {
                var headline = $(res.responseText).text();
                $("#conteudo").html(headline);
            }
        });*/

        $.ajax({
    url: 'http://www.sptrans.com.br/sac/solicitacoes.aspx',
    type: 'GET',
    success: function(res) {
        var headline = $(res.responseText).find('vUSRLOGA'); 
        $("#conteudo").html(headline);
    }
}); 

</script>


<title>Teste</title>
<body>




    <div id="conteudo" style="background:#EEF0A6"></div>


</body>
</html>

I want to show ONLY the part that is inside the red square:

image

Paulo Roberto
  • 1,498
  • 5
  • 19
  • 42

1 Answers1

1

As I understood, you have a website that wants access another website. It can't be done in javascript because of cross-domain policy.

Find element attributes on different domain using Javascript

Community
  • 1
  • 1
Nursultan Zarlyk
  • 402
  • 1
  • 4
  • 16
  • I saw this example here , but could not apply it , can help me adapt it , please? Portuguese is in the question: http://pt.stackoverflow.com/questions/68997/pegar-conte%C3%BAdo-de-outra-p%C3%A1gina-por-javascript-ou-jquery – Paulo Roberto Jul 16 '15 at 18:03