Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- url(r'^categories/(S+)/$',views.ItemListView.as_view(),name = 'Item-list'),
- class ItemListView(generics.ListAPIView):
- serializer_class = ItemSerializer
- renderer_classes = (JSONRenderer,BrowsableAPIRenderer)
- def get_queryset(self):
- category = get_object_or_404(Category, pk =self.args[0])
- return Items.objects.filter(category = category)
- User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
- Origin: http://localhost:8000
- Host: 127.0.0.1:8000
- Connection: keep-alive
- Access-Control-Request-Method: GET
- Access-Control-Request-Headers: content-type
- Accept-Language: en-US,en;q=0.5
- Accept-Encoding: gzip, deflate
- Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
- $('#category-box-list').on('click',function(){
- console.log('selected');
- var cat = $('#category-box-list').val();
- $.ajax({
- type :'GET',
- url :'http://127.0.0.1:8000/billing/categories/' + cat,
- contentType: 'application/json',
- crossDomain:true,
- success : function(json){
- console.log(json);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement