I want to import an entire page with jquery, should I divide the page into different jquerys so that I can write code through the jquerys?

Asked

Viewed 186 times

-1

With this jquery I am importing the whole page, but I can’t put html Divs in the middle of the query, only at the end.inserir a descrição da imagem aqui

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Getting Started with jQuery</title>
<script src="Scripts/jquery-3.0.0.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#divteste').load('AdminPagina.aspx')
    });
</script>
</head>
<body>
<form id="form1" runat="server">

    <div id="divteste">
        <span>Test inside div</span>
    </div>
</form>
</body>
**texto em negrito**</html>
  • Dude is very confused your question. You want to import html at the top, on the left and at the footer is this?

  • The import (black) I managed to do, through the import of another page (what I want is the same Dashboard on all pages), I made a jquery where I care the whole page. Only now I wanted to write where is the green (inside the import) only, I can only write underneath all import, where is the red. But yes basically what I want to do is what you said, getting by some gridviwes where the green is , thanks

  • Maybe the best thing is a framework that does this for you, like Vue.js, for example. Structuring code based on jQuery often gets disorganized

  • But then in case you wouldn’t have to separate the Imports. Make a html to top, side and footer and so do the import separately, leaving the middle free?

  • Guilherme , I think this is not so difficult to do so to the point of using framework , I say. But if I have no other option I’ll try thank you

  • Leandrade , yes my question was this , I will have to divide the Imports to be able to write among them ?

  • Can you import the parts together tbm, since on this page you already leave a separate space in the middle that in case it would be the html of the page (green part) that will receive the import, understood?

  • I think I realized , but then on the page I want, I call jquery with all the import together, already with the green space ready to put whatever you want , but and then how do I put there a div if I imported everything together ? how do I write in the middle of jquery ? you can call a div that is inside jquery ?

  • The green part you write normally, with Divs, and everything else.

  • If you notice the code above, I write the jquery and put it inside the <div id="divteste"> but then I can’t write anything else inside that div, I have to create another one and then this one writes me under all import (red zone). My question is what I call to write in the green part, thank you

Show 5 more comments

1 answer

0

Peter then as I said, you already have to bring the import with the right demarcation made with html and css (I don’t know if you’re using frameworks like bootstrap) to position the elements correctly. There on the page that receive these pre-positioned html, you can put whatever you want inside the form that in your case would be the green part of your image. Follow the example:

$(document).ready(function() {
  $('#divteste').load('AdminPagina.aspx')
});
#form1 {
  margin-top: 30px;
  height: 100vh;
  background-color: #999;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<body>
  <div id="divteste">
     <span>Aqui vai vir importado já -> Topnave - Sidenave - Footer</span>
  </div>
  <form id="form1" runat="server">
     <div id="conteudo">
       Aqui vc põe o que vc quiser
     </div>
  </form>
</body>

  • Yeah, I’m wearing bootstrap. It didn’t work, keep writing under import, because I am importing the whole page even with the right html markup. What he does is that it matters an empty div (the green area), but he won’t let me write what I want there. I don’t know if I’m doing anything wrong :/

  • Is the form appearing below? Try to place the form inside the div divestiture.

  • It is below the import (without seeing)

  • Pedro would need to see how are the import pages, because it seems to me that you are importing everything, the body tags tbm, you would have to assemble the page that will import only with Divs, each one already positioned.

  • Exactly, I’m importing the whole page, with scripts, css, links , bodys, everything. So should I build the page with just Divs ? Or I leave the page created as is but I only care about the Ivs that contain the Topnave - Sidenave - Footer ?

  • Yes Pedro, if import does not overwrite the current page, you have to import only the Divs.

  • But I recreate the page Adminpagina.aspx only with Divs? or I let it be and care only for Divs ? Divide in 3 Imports ? Topnave - Sidenave - Footer ?

  • Importing only Divs would be ideal.

  • 1

    OK I’ll try, thank you very much for your time . When I have news I will say

  • Splitting the Imports worked, now just deal with css. Now the scripts are gone, logout and session boot. When it mattered the full page worked

  • It matters in the current.

  • Already imported , my aspbutton for example , recognizes that it is a button but does not execute the script to log out , and I also care about the name of the Session on the Label , but if I call the session elsewhere says that there is no

Show 7 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.