get
  • value
  • tr
  • 2016-11-09 51 views 0 likes 
    0

    有行:获取值的行ID通过Ajax

    <tr id = "internal_route_id" name ="internal_route_id" value="'.`$data[1]['id']`.'"> 
    

    我想返回$data[1]['id']值,并张贴通过Ajax。 我尝试这样的:

    data: $("#first_step").serialize() 
        + '&internal_route_id=' + $("#internal_route_id").val() 
    

    注意first_step是表名。 谢谢!

    回答

    1
    Use following approach to get the value of tr and post it 
    
    <tr id ="internal_route_id" name="internal_route_id" value="'.`$data[1]['id']`.'"> 
    
    $(function(){ 
    var datavalue=$("#first_step tr").attr('value'); 
    //posting ajax use following 
    $.ajax({ 
    url:'', 
    data:{id: datavalue}, 
    success:function(data) 
    { 
         //success code goes here... 
    } 
    }); 
    }); 
    
    相关问题