I'm been googling around, but I don't quite understand how ajax works. Could please somebody explain how this works?
$.ajax({ url: "{{ url_for( 'app.slideshow.<tag>' ) }}", type: "", data: {'param':}, dataType: "", success : function(response) { }
What I'm trying to do is see if document.getElementsByClassName(current) has changed. If it has, it will ask app.py for comments and tags on current, and update the page without refreshing. I have no idea what to write to receive this on the app.py either.
I'll include my app.py, but it is not good.
from flask import Flask,session,url_for,request,redirect,render_template import api,db app = Flask(__name__) #app.secret_key = "secret" @app.route('/slideshow/<tag>', methods=['GET', 'POST']) def slide(): if request.method=="GET": pic = request.get('current').href taglist = db.getTaglist() tags = db.getTags(pic) piclist = db.getPics(<tag>) commentlist = db.getComments(pic) return render_template("slide.html", taglist = taglist, tags =tags, piclist =piclist, commentlist = commentlist, url = url) else: button = request.form['button'] pic = request.get('current').href if button=="submit": aComment = request.form['comment'] db.addComment(pic,aComment) elif button == "submitnewtag": if request.form['Addnewtag'] aTag = request.form['Addnewtag'] db.addTag(pic,aTag) else: aTag = request.form['select1'] db.addTag(pic,aTag) if __name__=="__main__": app.debug=True app.run(port=5300)