Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- This is an example on how to update contributions with jQuery from within your site -->
<p>The API says:</p>
<div id="response"></div>
<div id="error"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
var response = document.getElementById('response')
var error = document.getElementById('error')
$.ajax({
type:'POST',
url:'/api/v1/contribution/update',
data:{
campaign_id: '58772cb60aec087e67000014',
contribution_id: '58772cb60aec087e67000019',
amount: 200
},
success: function(json) {
console.log(json.responseText)
response.innerHTML = json.responseText
error.innerHTML = ''
},
error: function (err) {
console.log(err.responseText)
error.innerHTML = err.responseText
response.innerHTML = ''
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.