hi,

    you should consider of using JSON.stringify() function to convert 
javascript object to json data.

    *>>* *
JSON.stringify({'array':[{'que':1,'ans':3},{'que':1,'ans':2},{'que':4,'ans':5},{'que':2,'ans':4}]})
*
*    *This is example build from jsfiddle
*    >> alert example <http://jsfiddle.net/MXGt7/>
*

*    *hope this can help

On Friday, August 23, 2013 7:30:45 PM UTC+8, Sarfraz Ahmad wrote:
>
> Hello guys, i am working on a view where i m needed to pass an array of 
> objects into a ajax request.
> the array of java script objects is like this
>                                                               
>  [{'que':1,'ans':3},{'que':1,'ans':2},{'que':4,'ans':5},{'que':2,'ans':4}]
> i posted is in ajax request like
>
>       $.ajax({
>                   url:'/someurl/',
>                   type:'POST',
>                   data:{'array':[{'que':1,'ans':3},{'que':1,'ans':2},
> {'que':4,'ans':5},{'que':2,'ans':4}]},
>                   success:function(data){},
>                   error:function(data){}
> })
>
> but when i recieve it in view using
>                                                     
>  request.POST.get('array') or
>                                                     
> request.POST.getlist('array') 
> or 
>                                                    
> request.POST.getlist('array[]') 
>   It gives me a blank list not the data i have sent with the request.
>
>
> tell me how can i get this data in django view.
> any help would be appreciable 
>
>
>
>
>
>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to