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条)

报告相同问题?