Guest User

Untitled

a guest
Feb 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2. header('Content-Type: application/json');
  3. echo json_encode(array('One' => 'Test'));
  4. ?>
  5.  
  6. <script type = "text/javascript">
  7. let changeValue;
  8. $('#someElementID').click(function() {
  9. $.ajax({
  10. type: 'POST',
  11. url : 'phpfile.php',
  12. dataType : 'json',
  13. success: function(obj, textStatus) {
  14. changeValue = obj.One;
  15. }
  16. });
  17.  
  18. $('#toBeChangedElementValue').text(changeValue);
  19. }
  20. </script>
Add Comment
Please, Sign In to add comment