Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
im not able to send data to view due json serializable

i am getting error set object is not JSON serializable i also used json.dumps but still getting this error ? actually i am trying to save form data to django database with help of ajax but where i am doing mistake

    def update_ajax(request):
       if request.method == "GET" and request.is_ajax():
          nam1 = request.GET.get('nam1')
          nam2 = request.GET.get('nam2')
          nam3 = request.GET.get('nam3')
          n1 = json.loads(nam1)
          n2 = json.loads(nam2)
          n3 = json.loads(nam3)
          print(n1, n2, n3)
    return JsonResponse({'success'}, safe=False)

script

function myfun(){
    let nam1=document.getElementById('name').value;
    let nam2=document.getElementById('email').value;
    let nam3=document.getElementById('phone').value;

    obj ={
        'nam1': JSON.stringify(nam1),
        'nam2':JSON.stringify(nam2),
        'nam3':JSON.stringify(nam2),
    }
    

    $.ajax({
        type:"GET",
        url: "{% url 'update_ajax' %}",
        dataType: "json",
        data:   obj, 
        
        success:function(){
            alert('success')
        }
        
    });

}
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!