Skip to content

Instantly share code, notes, and snippets.

@iaincarsberg
Created September 14, 2011 09:43
Show Gist options
  • Save iaincarsberg/1216206 to your computer and use it in GitHub Desktop.
Save iaincarsberg/1216206 to your computer and use it in GitHub Desktop.
jQuery snippet for accessing a controller implemented using https://github.com/managedit/kohana-api
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="/js/libs/json2.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$.ajax({
url: '/api/login',
type: 'POST',
data: JSON.stringify({id: 123}),
processData: false,
contentType: 'application/json',
success: function (data) {
console.log(data.payload);
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment