Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用ajax进行简单导航_Jquery_Ajax_Page Refresh - Fatal编程技术网

Jquery 使用ajax进行简单导航

Jquery 使用ajax进行简单导航,jquery,ajax,page-refresh,Jquery,Ajax,Page Refresh,我在Ajax刷新我的公文包页面时遇到了一些noob问题。 我只是尝试使用ajax使容器div动态化,这并不复杂,但无法在这方面取得成功 切片的内容很好地加载到刷新的页面上,但在我单击其他链接后,什么也没有发生 我对Ajax非常陌生,如果你有好的链接,我很想了解它是如何工作的 这是密码 <!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""&

我在Ajax刷新我的公文包页面时遇到了一些noob问题。 我只是尝试使用ajax使容器div动态化,这并不复杂,但无法在这方面取得成功

切片的内容很好地加载到刷新的页面上,但在我单击其他链接后,什么也没有发生

我对Ajax非常陌生,如果你有好的链接,我很想了解它是如何工作的

这是密码

    <!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="apple-touch-icon" href="apple-touch-icon.png">

        <link rel="stylesheet" href="css/bootstrap.min.css">
        <style>
            body {
                padding-top: 5%;

            }
        </style>
        <link rel="stylesheet" href="css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" type="text/css" href="dist/css/slider-pro.css" media="screen"/>
        <link rel="stylesheet" type="text/css" href="css/examples.css" media="screen"/>
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600' rel='stylesheet' type='text/css'>

        <script type="text/javascript" src="libs/jquery-1.11.0.min.js"></script>
        <script type="text/javascript" src="dist/js/jquery.sliderPro.min.js"></script>

        <script src="js/vendor/modernizr-2.8.3-respond-1.4.2.min.js"></script>







    </head>
    <body>
        <!--[if lt IE 8]>
            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#"><big>Chris Kalmar</big> <small>portfolio</small></a>
          </div>
        </div>
    </nav>
    <div class"container-fluid">
     <div class"row">
     <div class"col-xs-6">

      <ul>
          <li class="branding"><a href="#">Branding</a></li>
          <li class="3d"><a href="#">3D</a></li>
          <li class="Apps"><a href="#">Apps</a></li>
      </ul>
    </div>
    </div>  
    </div>

    <div class="container">

    <!-- ajax call--> 




    <!-- /ajax call--> 


    </div><!-- / container--> 



     <footer>
        <p>Chris Kalmar - All rights reserved 2015</p>
    </footer>


       <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>

        <script src="js/vendor/bootstrap.min.js"></script>

        <script src="js/plugins.js"></script>
        <script src="js/main.js"></script>

        <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
        <script>
            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
            e.src='//www.google-analytics.com/analytics.js';
            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
            ga('create','UA-XXXXX-X','auto');ga('send','pageview');
        </script>

  <script> 

  $(function () { $(".branding").click(function () {
    $.ajax({
          url: 'branding.html',
          data: { id: $(this).attr('id') },
          cache: false,
          success: function (data) {
              $(".container").replaceWith(data);  //try with double qoutes
          }
    });
});



  </script>
<script>
$(function () { $(".3d").click(function () {
    $.ajax({
          url: '3d.html',
          data: { id: $(this).attr('id') },
          cache: false,
          success: function (data) {
              $(".container").replaceWith(data);  //try with double qoutes
          }
    });
});

</script>





    </body>
</html>

身体{
垫面:5%;
}
切换导航
Chris Kalmar-版权所有2015

window.jQuery | | document.write(“”) (函数(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]| |(b[l]= 函数(){(b[l].q=b[l].q | |[]).push(参数)});b[l].l=+新日期; e=o.createElement(i);r=o.getElementsByTagName(i)[0]; e、 src='//www.google-analytics.com/analytics.js'; r、 parentNode.insertBefore(e,r)}(窗口,文档,'script','ga'); ga(“创建”、“UA-XXXXX-X”、“自动”);ga('send','pageview'); $(函数(){$(“.branding”)。单击(函数(){ $.ajax({ url:'branding.html', 数据:{id:$(this.attr('id')}, cache:false, 成功:功能(数据){ $(“.container”).replaceWith(data);//尝试使用双qoutes } }); }); $(函数(){$(“.3d”)。单击(函数(){ $.ajax({ url:'3d.html', 数据:{id:$(this.attr('id')}, cache:false, 成功:功能(数据){ $(“.container”).replaceWith(data);//尝试使用双qoutes } }); });
没有任何更改,因为您得到304个代码,这意味着未修改。请尝试使用不带缓存的ajax调用:

$(function () { $(".branding").click(function () {
    $.ajax({
          url: 'branding.html',
          data: { id: $(this).attr('id') },
          cache: false,
          success: function (data) {
              $(".container").replaceWith(data);  //try with double qoutes
          }
    });
});

没有任何更改,因为您得到304代码,这意味着未修改。请尝试使用不带缓存的ajax调用:

$(function () { $(".branding").click(function () {
    $.ajax({
          url: 'branding.html',
          data: { id: $(this).attr('id') },
          cache: false,
          success: function (data) {
              $(".container").replaceWith(data);  //try with double qoutes
          }
    });
});

哦,我忘了这是网站的链接:你需要添加事件处理程序,因为你触发了部分回发。试着阅读文章来帮助你整理。哦,我忘了这是网站的链接:你需要添加事件处理程序,因为你触发了部分回发。试着阅读文章来帮助你整理。谢谢您好,但很抱歉,这不起作用,请参阅:这是结果…您忘记用
$(函数(){$(“.branding”)。单击(函数(){/*code here*/});});
ID的角色是什么?可能我需要更改此内容?您将此脚本放置在您的主页的确切位置?我在任何地方都看不到它。请确保它作为最后一个脚本加载,因此它应放置在main中。jsI只能在
结束标记之前看到它。我已编辑了我的答案,请更改您的代码。谢谢您,米切尔,但是sorr如果这不起作用,请参见:这是结果…您忘记用
$(函数(){$(“.branding”)。单击(函数(){/*code here*/};})
ID的角色是什么?可能我需要更改此角色?您将此脚本放置在您的主页的确切位置?我在任何地方都看不到它。请确保它作为最后一个脚本加载,因此它应放置在main中。jsI只能在
结束标记之前看到它。我已编辑了我的答案,请更改您的代码。