1๐
I would need to see your url set up for the api to give you more help, but for starters the original url you provided:
url: 'url/to/site/contacts/api/v1/adresponses/1',
and the one in your answer
url: '../../api/v1/user/',
do not call the same resource which makes it even harder to diagnose.
However, the first url is an absolute path and the second is relative which could be causing issues with your ALLOWED_HOSTS setting which could be generating the 400 error.
so try this:
$.ajax({
url: '../../api/v1/adresponses/1',
contentType: 'application/json',
type: 'GET',
success: function(data, textStatus, jqXHR) {
console.log(data);
}
});
YES, without a success function you will not see any results:
success: function(data, textStatus, jqXHR) {
console.log(data);
}
that console.log is what makes you see a result in your console.
Your origanal code does not provide:
contentType: 'application/json',
You have:
accepts: 'application/json',
0๐
I think the problem is that the use of โ/โ at end of the url is mandatory.
You should try with url: โurl/to/site/contacts/api/v1/adresponses/1/โ,
when you visiting url/to/site/contacts/api/v1/adresponses/1 it redirect to url/to/site/contacts/api/v1/adresponses/1/, depending of your tastypie configuration
- [Answer]-Filtering by foreign key in dropdown
- [Answer]-Django static img not showing in my blog
- [Answer]-How do I use python libraries inside django?
- [Answer]-Django session data obtainable from models.py without key
- [Answer]-Returning a variable inside a SessionWizardView