On Saturday, 31 March 2012 23:23:26 UTC+1, Ahmad wrote: > > I trying to use jquery ajax to send json data to django > > sorry if providing javascript code but it may help solving my problem > ____________________ > $("#send").click(function() { > events = $('#calendar').fullCalendar('clientEvents'); > console.log(events); > var filter = new Array(); > filter[0] = 'start'; > filter[1] = 'end'; > filter[2] = 'title'; > events = JSON.stringify(events, filter, '\t'); > console.log(events); > $.ajax({ > type: "POST", > data: "events", > url: <my_url>, > }); > }); > _____________________ > > on chrome devtool every thing is ok until the last $.ajax() > > it throw this error > > > 1. POST <my_url> <http://%3Cmy_url%3E/> 500 (OK) > 1. > f.support.ajax.f.ajaxTransport.sendjquery-1.7.1.min.js:4<http://localhost:8080/static//jquery/jquery-1.7.1.min.js> > 2. > f.extend.ajaxjquery-1.7.1.min.js:4<http://localhost:8080/static//jquery/jquery-1.7.1.min.js> > 3. (anonymous function)<my_url> <http://%3Cmy_url%3E/> > 4. > f.event.dispatchjquery-1.7.1.min.js:3<http://localhost:8080/static//jquery/jquery-1.7.1.min.js> > 5. f.event.add.h.handle.i > > > > so why am I getting 500 error, event I tried to use csrf_exempt or > disabling the csrf entirely but nothing changed > > If any one can figure out what I'm doing wrong please go ahead > > thanks in advance > > Ahmad > > 1. > >
If that's your real code, you seem to be sending the string "events" as the POST data. Presumably you meant to send the contents of the variable events instead. -- DR. > > 1. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IyNt8bVGtN4J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.