4

I'm pretty new to Django (and web development) and find myself struggling with this problem. I'm able to pass the data from Django to javascript HTML

 function load_led(){
    {% for leds in led %}

        var str2 = "{{leds.name}}"
        var x = {{leds.x}}
        var y = {{leds.y}}
        var w = 30
        var h = 30
        var fill = "{{leds.color}}"

        document.getElementById("FirstName").value = str2;
        document.getElementById("xposition").value = x;
        document.getElementById("yposition").value = y;
        document.getElementById("status").value = fill;

        add1(x,y,fill);
    {% endfor %} 
} 

Now I change the values of Elements and then want to pass this values again to Django so that I can update my database. So how can I pass the values from javascript or from HTML page

ketan khandagale
  • 460
  • 6
  • 22

1 Answers1

1

You need to make an ajax call or similar to pass data to the server. You can make it very fast with jquery

jbartolome
  • 302
  • 2
  • 12
  • 1
    Can you please explain with the example or can you please post the link of sample example in which ajax is explained ? – ketan khandagale Jan 23 '14 at 20:04
  • check out this question: http://stackoverflow.com/questions/13465711/how-do-i-post-with-jquery-ajax-in-django – monkut Jan 23 '14 at 20:49