Last active
July 9, 2016 16:11
-
-
Save NightOwlPrgmr/b50a2a37e4c41f2593bb to your computer and use it in GitHub Desktop.
Basic AJAX Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = {}; | |
request['action'] = 'submit'; | |
request['data'] = $(this).val() || $(this).closest('form').serialize(); | |
$.ajax({ | |
url: "<?= $URL; ?>", || url: 'someFile.php', | |
data: request, || JSON.stringify(request), || | |
type: 'POST', | |
cache: false, | |
dataType: 'json' | |
}).done(function(response) { | |
// done function | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment