dongleman4760 2017-08-10 07:02
浏览 51
已采纳

在php和ajax代码中的Jquery ajax问题

Here in the following code in jquery i get the alert test1 but when i try to get alert test2 i dint got that... there is some issue in code please help me to resolve.

$(document).ready(function() {
  $(".delete-item-details").click(function() {
    alert('test1');
    var id = $(this).attr('ids');
    alert('test2');
    var order_id = $("#order_id").val();

    goto_url = "/order/DeleteOrderDetailItems/" + id;
    dataString = 'id=' + id + '&order_id=' + order_id;
    $.ajax({
      type: "POST",
      url: goto_url,
      data: dataString,
      cache: false,
      success: function(html) {
        $("#row-id-" + id).fadeOut();
        $("#total_span").html(html);
      }
    });
  });
});
  • 写回答

2条回答 默认 最新

  • dongsunny1113 2017-08-10 07:04
    关注

    Please change this three lines in code and you will definitely get alert !!

    alert('test1');
                    var id=$(this).attr('id');  // here you have written ids
    alert('test2');
    

    The default attribute is 'id' not 'ids'

    If still now clear let me know i will help you out.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大