Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

through my journey on understanding ajax i came up with this problem and i don't know how to solve it first im requesting for datas in my table

load_data();
function load_data(page)  
      {  
           $.ajax({  
                url:"data.php",  
                method:"POST",  
                data:{page:page},  
                success:function(data){  
                     $('#result').html(data);  
                },
                error:function(exception){alert('Exeption:'+exception);}                
           })  
      }

this is just the table where it will be output

    <table>
        <thead>
            <tr>
              <th>name</th>
              <th>details</th>
              <th>price</th>
              <th></th>
            </tr>
        </thead>
        <tbody id = "result">

and this is the output from network tab

Response from network tab

there's a button from the response i tried to activate it using this jquery to submit its form but this doesn't work

  $(document).on('click', '#add_details', function(){  
       $(this).parents("form").submit();
  });
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
206 views
Welcome To Ask or Share your Answers For Others

1 Answer

add id to the form you need to submit with button click like

<form id="myForm1">
//Other Code Here

and with your button just Use the id you added

$(document).on('click', '#add_details', function(){  
       $("#myForm1").submit();
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...