Category : ajax

I am trying to make a flask app that should render something from an ajax to a div, but it does not work. This is what I have tried : flask @app.route(‘/preview’) def preview(): return "wowowowowow" <script> $(document).ready( function() { $(‘#preview_button’).click(function() { $.ajax("{{ url_for(‘preview’) }}").done(function (reply) { $(‘#container’).html(reply); }); }); }); </script> <input type="button" name="preview_button" ..

Read more

my Csv viewer doesnot work in Flask…. CSV Viewer code I have combined 2 different code . <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="../../../maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="../../../ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="papaparse.min.js"></script> <style> .pdfobject-container { height: 100px;} .pdfobject { border: 1px solid #666; } ** Style ** </style> </head> <body> Side Navigation Bar <div class="wrapper"> <div ..

Read more

I need to send a list from an ajax call using JQuery, and send a response with Django {{ variables }} inside them, I tried everything, but the JQuery always loads the entire current page instead of loading the html file that contains the template partial, which is just <!– city_dropdown_list_options.html –> <option value="">—-city list—-</option> ..

Read more

Am trynig to post data from an input to my django view to do some processing on this data ,which is a text, and am using AJAX but I get the input NULL in my view $(document).on(‘submit’, ‘#post-form’,function(e){ $.ajax({ type:’POST’, url:'{% url "index" %}’, data:{ inp:$(‘#qst’).val() csrfmiddlewaretoken:$(‘input[name=csrfmiddlewaretoken]’).val(), action: ‘post’ }, dataType: ‘json’, success:function(json){ document.getElementById("post-form").reset(); $(".messages_area").append(‘<div ..

Read more

I’m working in a project where I capture image from mirror cam website and save that image in a file using flask. I’m using mirror cam website to get live webcam using flask. flaskTest.py from flask import Flask, render_template, request from datetime import datetime import base64 app = Flask(__name__) @app.route("/",methods=[‘POST’,’GET’]) def home(): if request.method == ..

Read more

I have this problem in my AJAX and Flask. The error says "Uncaught TypeError: secondPassword is undefined" but secondPassword is Clearly visible in the Ajax part. This is the AJAX Part: $.ajax({ data : { password : $(‘#password’).val(), secondPassword : $(‘#rePass’).val() }, type : ‘POST’, url : ‘/checkSecondPassword’ }) .done(function(secondPassword){ if(secondPassword.error) { $(‘#passwordError’).text(secondPassword.error);//.show(); $(‘#rePassError’).text(secondPassword.error);//.show(); } ..

Read more