Created
May 4, 2018 16:35
-
-
Save crowdfundhq/19b00ffbdff2bbb0d574253b1d1713d2 to your computer and use it in GitHub Desktop.
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
<!-- 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