AJAX request in Bootstrap

Asked

Viewed 922 times

1

Hello

I am needing to open an external page through an AJAX request on my ROW in Bootstrap, but I am not succeeding, I am following the tutorial of the link below, but it is not opening my page in Bootstrap ROW, how can I do ? Have some native Bootstrap function for that ?

http://tedk.com.br/blog/html/carregar-uma-pagina-dentro-de-uma-div-com-ajax/

Code:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>load demo</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <style>
        body {
        font-size: 12px;
        font-family: Arial;
        }
    </style>
    </head>
    <body>

    <b>Projects:</b>
    <div id="new-projects" style="width:400px, height:400px"></div>

    <script type="text/javascript">
        $( "#new-projects" ).html('<object data="https://answall.com"/>');
    </script>
    </body>
    </html>

Thank you

1 answer

1


Use this:

$( "#new-projects" ).html('<object data="https://answall.com"/>');
  body {
    font-size: 12px;
    font-family: Arial;
  }
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>load demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
 
<b>Projects:</b>
<div id="new-projects"></div>
 
 
</body>
</html>

  • I know your code, but it’s not running, because ?

  • See if you are loading jQuery. A question, the page is external, another domain?

  • So, this is showing up on my console ( Refused to display 'https://answall.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'. en.stackoverflow.com/ Failed to load Resource: net::ERR_BLOCKED_BY_RESPONSE /favicon.ico Failed to load Resource: the server responded with a status of 404 (Not Found) )

  • And I put your script up on an online host. But it doesn’t work.

  • The reason is dominance. Ex: if I am at www.meusite.com I can call www.meusite.com/otherapy, but calling www.google.com for security does not allow.

  • 1

    That’s cool. Now it works. Thank you.

Show 1 more comment

Browser other questions tagged

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