• <bdo id='cnaqW'></bdo><ul id='cnaqW'></ul>

    <tfoot id='cnaqW'></tfoot>
    <i id='cnaqW'><tr id='cnaqW'><dt id='cnaqW'><q id='cnaqW'><span id='cnaqW'><b id='cnaqW'><form id='cnaqW'><ins id='cnaqW'></ins><ul id='cnaqW'></ul><sub id='cnaqW'></sub></form><legend id='cnaqW'></legend><bdo id='cnaqW'><pre id='cnaqW'><center id='cnaqW'></center></pre></bdo></b><th id='cnaqW'></th></span></q></dt></tr></i><div id='cnaqW'><tfoot id='cnaqW'></tfoot><dl id='cnaqW'><fieldset id='cnaqW'></fieldset></dl></div>

      <small id='cnaqW'></small><noframes id='cnaqW'>

      1. <legend id='cnaqW'><style id='cnaqW'><dir id='cnaqW'><q id='cnaqW'></q></dir></style></legend>
      2. JQuery日期选择器在ajax调用后不起作用

        JQuery datepicker not working after ajax call(JQuery日期选择器在ajax调用后不起作用)
        <tfoot id='2fROX'></tfoot>

              1. <small id='2fROX'></small><noframes id='2fROX'>

                <i id='2fROX'><tr id='2fROX'><dt id='2fROX'><q id='2fROX'><span id='2fROX'><b id='2fROX'><form id='2fROX'><ins id='2fROX'></ins><ul id='2fROX'></ul><sub id='2fROX'></sub></form><legend id='2fROX'></legend><bdo id='2fROX'><pre id='2fROX'><center id='2fROX'></center></pre></bdo></b><th id='2fROX'></th></span></q></dt></tr></i><div id='2fROX'><tfoot id='2fROX'></tfoot><dl id='2fROX'><fieldset id='2fROX'></fieldset></dl></div>
                • <bdo id='2fROX'></bdo><ul id='2fROX'></ul>
                    <tbody id='2fROX'></tbody>

                • <legend id='2fROX'><style id='2fROX'><dir id='2fROX'><q id='2fROX'></q></dir></style></legend>
                  本文介绍了JQuery日期选择器在ajax调用后不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下代码

                  <头>//包括所有jquery相关的东西..这里没有显示<身体><按钮 id = 'btn'/>

                  <?php echo file_get_contents('my_ajax_stuff.php');?>

                  <脚本>$('.datepicker').datepicker({dateFormat: "dd-mm-yy"});$('#btn').click(function() {$.ajax({类型:获取",url: "my_ajax_stuff.php" ,成功:功能(响应){$('#ct').html(响应);/*添加以下行来解决这个问题..但没有奏效*///$( ".datepicker" ).datepicker({dateFormat: "dd-mm-yy"});} ,错误:函数(){$('#ct').html("获取数据时出现问题,请重试");}});});

                  页面

                  <块引用>

                  my_ajax_stuff.php

                  包含一个类 = 'datepicker' 的 jquery ui datepicker.在第一次加载时,datepicker 可以工作.但是当我再次单击按钮重新加载时,内容被新内容替换.但是 datepicker 不起作用.我已经尝试在 ajax 成功处理程序中初始化日期选择器,如您所见.但它也失败了.这是什么问题.如何解决???

                  解决方案

                  你需要重新初始化Ajax成功中的日期选择器

                  $('.datepicker').datepicker({dateFormat: "dd-mm-yy"});$('#btn').click(function() {$.ajax({类型:获取",url: "my_ajax_stuff.php" ,成功:功能(响应){$('#ct').html(响应);$( "#datepicker" ).datepicker();/*添加以下行来解决这个问题..但没有奏效*///$( ".datepicker" ).datepicker({dateFormat: "dd-mm-yy"});} ,错误:函数(){$('#ct').html("获取数据时出现问题,请重试");}});});

                  I have the following code

                  <html>
                      <head>
                         //included all jquery related stuff ..not shown here
                      </head>
                      <body>
                         <button id = 'btn' />
                         <div id = 'ct'>
                               <?php echo file_get_contents('my_ajax_stuff.php'); ?>
                         </div>
                      </body>
                      <script>
                         $('.datepicker').datepicker({dateFormat: "dd-mm-yy"});
                         $('#btn').click(function() {
                             $.ajax({
                              type: "GET",
                              url: "my_ajax_stuff.php" ,
                              success: function(response) {
                                  $('#ct').html(response);
                                  /*added following line to solve this issue ..but not worked*/
                                  //$( ".datepicker" ).datepicker({dateFormat: "dd-mm-yy"});
                  
                              } ,
                              error: function () {
                                  $('#ct').html("Some problem fetching data.Please try again");
                              }
                          });
                         });
                      </script>
                  </html>
                  

                  The page

                  my_ajax_stuff.php

                  contains a jquery ui datepicker with class = 'datepicker'.On the first load the datepicker works.But when I click on the button to reload it again , the contents are replaced with new contents.But the datepicker is not working.I have tried initialising the datepicker inside the ajax success handler ,as you see.But it also failed.What is the issue.How can it be solved???

                  解决方案

                  You need to reinitialize the date picker in Ajax success

                  $('.datepicker').datepicker({dateFormat: "dd-mm-yy"});
                  
                  $('#btn').click(function() {
                      $.ajax({
                          type: "GET",
                          url: "my_ajax_stuff.php" ,
                          success: function(response) {
                  
                              $('#ct').html(response);
                              $( "#datepicker" ).datepicker();
                              /*added following line to solve this issue ..but not worked*/
                              //$( ".datepicker" ).datepicker({dateFormat: "dd-mm-yy"});
                  
                          } ,
                          error: function () {
                              $('#ct').html("Some problem fetching data.Please try again");
                          }
                      });
                  });
                  

                  这篇关于JQuery日期选择器在ajax调用后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)

                    <small id='EJLJK'></small><noframes id='EJLJK'>

                    • <legend id='EJLJK'><style id='EJLJK'><dir id='EJLJK'><q id='EJLJK'></q></dir></style></legend>
                        <bdo id='EJLJK'></bdo><ul id='EJLJK'></ul>

                          <tfoot id='EJLJK'></tfoot>

                              <tbody id='EJLJK'></tbody>
                            <i id='EJLJK'><tr id='EJLJK'><dt id='EJLJK'><q id='EJLJK'><span id='EJLJK'><b id='EJLJK'><form id='EJLJK'><ins id='EJLJK'></ins><ul id='EJLJK'></ul><sub id='EJLJK'></sub></form><legend id='EJLJK'></legend><bdo id='EJLJK'><pre id='EJLJK'><center id='EJLJK'></center></pre></bdo></b><th id='EJLJK'></th></span></q></dt></tr></i><div id='EJLJK'><tfoot id='EJLJK'></tfoot><dl id='EJLJK'><fieldset id='EJLJK'></fieldset></dl></div>