jquery - send lon lat data from javascript to server -
i new front end developing. on client side trying type in adress, , extract corresponding long lat coordinates, in order send them flask. how can send long lat data javascript flask? here code
$("#yes").click(function(event) { var text = $('#bt1').val(); $.get(url + 'text=' + text, function(data) { var result1= json.parse(data); $.ajax({ url: url2, type: "post", data: json.stringify(data), <-- here want put long lat data datatype: 'json', success: function(response){ console.log("ok"); }, error: function(xhr) { console.log("error"); } }); }); });
on server side set up:
@app.route('/something', methods=['post']) def something(): conn = g.db.cursor() return null
but error message of type 404.
solved it! have same problem here code:
$.ajax({ url: my_url, type: "post", data: {"x": lat, "y": long}, success: function(response){ console.log("something"); }, error: function(xhr) { console.log("error"); } });
Comments
Post a Comment