Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-Type: application/json');
- echo json_encode(array('One' => 'Test'));
- ?>
- <script type = "text/javascript">
- let changeValue;
- $('#someElementID').click(function() {
- $.ajax({
- type: 'POST',
- url : 'phpfile.php',
- dataType : 'json',
- success: function(obj, textStatus) {
- changeValue = obj.One;
- }
- });
- $('#toBeChangedElementValue').text(changeValue);
- }
- </script>
Add Comment
Please, Sign In to add comment