4

Here is my original code in Javascript

var wt_val = [];

        for (i = 0; i<human_wt.length; i++){
          var mult;
          mult = data_list[basket_list[button_port_name][i]].map(x => x*(wt[i]/100));
          wt_val.push(mult);
        }

wt_val is a list or a list of lists.

Now I am sending this to the server.

          $.ajax({
          type: 'GET',
          url: '/add',
          data: {hoot: wt_val},
          success: function(results){

            alert("success");

          },
          error: function(error) {
          }
        });

Again, no error here.

But no value is received here.

app.route('/add', methods=['GET'])
def sum():

    start = request.form.getlist('hoot[]')
    print type(start)
    print len(start)

Length is 0

1
  • You called it hoot, not hoot[]. Commented Dec 5, 2016 at 6:09

1 Answer 1

1

you will need to do something like this

 paramtoget= { pval: wt_val};

in your post

 $.post('..abc.aspx' + Math.random()
               , {
 param: paramtoget
}

on server side

 var value = Request.Form("param[pval][]")

Hope this helps

Sign up to request clarification or add additional context in comments.

1 Comment

I tried this but it doesn't work, on the server side, it kept on giving me error imutableobjectdict is uncallable. When I tried using request.form.getlist, the object is empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.