adrianmihaipaun

Untitled

Feb 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. $(document).ready(function() {
  2. $(".users").click(function () {
  3. $("#user_devices").show();
  4. var user_id = $(this).attr('user_id');
  5. $.ajax({
  6. url: 'user_devices.php',
  7. type: 'GET',
  8. data: {user_id: user_id}
  9. }).done(function (result) {
  10. $('#user_devices').html(result);
  11. });
  12. $("#user_devices_dropdown").show();
  13. var device_id = $(this).attr('dropdown_select');
  14. $.ajax({
  15. url: 'select_device.php',
  16. type: 'POST',
  17. data: {user_id: user_id, device_id: device_id}
  18. }).done(function (dropdown_result) {
  19. $('#user_devices_dropdown').html(dropdown_result);
  20. $(".save_device").click(function() {
  21. var device_id = $('#dropdown_select: selected').attr('value');
  22. $.ajax({
  23. url: 'save_user_devices.php',
  24. type: 'POST',
  25. data: {user_id: user_id, device_id: device_id}
  26. }).done(function (save_result) {
  27. $("#user_devices_dropdown").html(save_result);
  28. });
  29. });
  30. });
  31. });
  32. });
Advertisement
Add Comment
Please, Sign In to add comment