Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. echo "<table class='table'>".
  2. "<thead>".
  3. "<tr>".
  4. "<td>ID</td>".
  5. "<td>url_video</td>".
  6. "</tr>".
  7. "</thead><tbody>";
  8. while($valor = mysqli_fetch_array($resultado)){
  9. echo "<tr>".
  10. "<td>".$valor['ID']."</td>".
  11. "<td><input type='text' value='".$valor['url_video']."' style='width: 400px;' id='url-video'></td>".
  12. "<td><input type='button' value='Update' class='btn-update' data-id='".$valor['ID']."' >"."</td>".
  13. "</tr>";
  14. }
  15. echo "</tbody></table>";
  16.  
  17. $(document).ready(function(){
  18.  
  19. $('.btn-update').click(function(){
  20. var id = $('.btn-update').data('id');
  21. var string = $('.url_video').val();
  22.  
  23. $.ajax({
  24. url: "tabelaUpdate.php",
  25. data: { 'idDeUpdate' : id,
  26. 'url_video' : string
  27. },
  28. type: "POST",
  29. cache: false,
  30. success: function(response){
  31. //alert("ok"+response);
  32. $('#result').html(response); //serve para ver a array foi inserida mesmo
  33. }
  34. })
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement