【问题标题】:button click event with get php page not working带有获取 php 页面的按钮单击事件不起作用
【发布时间】:2013-12-02 20:59:52
【问题描述】:

我使用 jquery get() 方法将我的 PHP 页面放入“div”。

这是我目前尝试过的代码 -

$(function(){
  $('#rssRedirect').click( function(){
    var jqxhr = $.get( "event.php?within=100", function(response) {
      $('#page-right-event-result-wrapper').html(response);
    })
  })
})

按钮点击事件我做错了什么?

【问题讨论】:

    标签: javascript php jquery button get


    【解决方案1】:

    您的语法已关闭。试试:

    $(document).ready(function(){
        $('#rssRedirect').click( function(){
            var jqxhr = $.get( "event.php?within=100", function(response) {
                $('#page-right-event-result-wrapper').html(response);
            });
        });
    });
    

    【讨论】:

      【解决方案2】:

      解决方案如下:

      $(function(){
      $('#rssRedirect').click( function(event){
      event.preventDefault();
      var jqxhr = $.get( "event.php?within=100", function(response) {
      $('#page-right-event-result-wrapper').html(response);
      })
      })
      })
      

      【讨论】:

        猜你喜欢
        • 2018-09-18
        • 2014-09-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多