Re: Using jquery ajax POST method with django

2015-01-21 Thread carlos
if you comment middleware csrf this is a risk security problem in your app maybe you need read this part of documentation https://docs.djangoproject.com/en/1.7/ref/contrib/csrf/#ajax Cheers On Sat, Jan 17, 2015 at 10:44 PM, Hossein Rashnoo wrote: > I correct my code and it's worked. Thank you

Re: Using jquery ajax POST method with django

2015-01-17 Thread Hossein Rashnoo
I correct my code and it's worked. Thank you guys for your help. Ajax Code: function checkuser() { var myObject = new Object(); myObject.username = $('#username').val(); myObject.password = $('#password').val(); $.ajax({ url: 'http://10.252.84.159/ajaxrecivelogin/',

Re: Using jquery ajax POST method with django

2015-01-17 Thread Vijay Khemlani
Maybe it's triggering the CSRF validation? What error message are you getting exactly from the server? On Sat, Jan 17, 2015 at 10:37 AM, Erwin Sprengers wrote: > Hello, > > POST works fine for me, I use the following django code : > > at the end of the view : > > return HttpResponse(simplejson.

Re: Using jquery ajax POST method with django

2015-01-17 Thread Erwin Sprengers
Hello, POST works fine for me, I use the following django code : at the end of the view : return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript') and following ajax code : $.ajax({ url: '/ajax/is_key_mm/', type: 'POST', asy

Using jquery ajax POST method with django

2015-01-16 Thread Hossein Rashnoo
I use this code to send a request: function checkuser() { $.ajax({ url: 'http://10.252.84.159/ajaxrecivelogin', //type: 'POST', data: "{'username': 'aa', 'password' : 'bb'}", context: this, dataType: 'json', success: function (data) {