-2
@app.route('/get_all/<string:name>', methods=['GET'])
def get_info_of_person(name):
    if request.method == 'GET':
        person = [city for city in cities if city['name'] == name]
        print(person)
        return jsonify({'names_list': person[0]})
    else:
        return render_template('dashboard.html')

I want to capture those values form the front end using Jquery

Arkej
  • 2,221
  • 1
  • 14
  • 21
Sandaru
  • 13
  • 1
  • 8

1 Answers1

1

You can use $ajax to make a GET request.

 $.ajax({
          url: '/get_all/'+name,
          type: 'GET',
          dataType: 'json',
       })
         .done(function(data) {
              var names_list = data["names_list"];
              /* Do your processing here 
                                       */

          })
           .fail(function() {
               console.log("error");

          });
Abhi
  • 442
  • 1
  • 10
  • 24