Last active
December 26, 2015 19:09
-
-
Save joshuaadrian/7199226 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$('.parentElement').on('click', '.dynamicChildElement', function() { | |
$.ajax('/relative_file_path.php', { | |
type: "POST", // Defaults to get | |
data: { | |
'key' : 'value', | |
'key' : 'value' | |
}, | |
dataType: 'json', // If retrieving JSON | |
contentType: 'application/json', // If retrieving JSON | |
success: function(response) { | |
// Success code here | |
}, | |
error: function(request, errorType, errorMessage) { | |
// Error code here | |
}, | |
timeout: 3000, // Defaults to browser default, so best to set explicitly set it | |
beforeSend: function() { | |
// Good place to place loading gif / animation | |
}, | |
complete: function() { | |
// Fires after success or error | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment