weixin_33670786 2011-07-07 06:23 采纳率: 0%
浏览 40

jQuery Ajax内部函数

$(function () {
    $("#rv-title").click(function(event) {
    $("#rv-content").toggle();



  $.ajax({
        url: 'index.php?route=check',
        dataType: 'json',
        success: function(json) {
            if (json['output']) {
                $('#cart .content').html(json['output']);
            }
        }
    });  


    event.stopPropagation();
});


$(document).click(function(event) {
    var a = $(event.target).andSelf().parents("#rv-content");
    if (a.length == 0 && $("#rv-content").is(":visible")) {
        $("#rv-content").toggle();
      }
   });
});

Where my ajax function is, is that the right place to put it?

Thanks

  • 写回答

2条回答 默认 最新

  • weixin_33695450 2011-07-07 06:26
    关注

    try this

     $("#rv-content").toggle(function(){
        //your ajax call
    
        });
    

    or

     $("#rv-content").toggle(function(){
    
    my_ajax();
    
    });
    
    function my_ajax(){
    
    //ajax call
    
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制