title: How does ajax work with python?
body: <p>I'm been googling around, but I don't quite understand how ajax works. <strong>Could please somebody explain how this works?</strong></p>
  
  <pre><code>$.ajax({
          url: "{{ url_for( 'app.slideshow.&lt;tag&gt;' ) }}",
          type: "",
          data: {'param':},
          dataType: "",
          success : function(response)
          {
          }
  </code></pre>
  
  <p>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. </p>
  
  <p>I'll include my app.py, but it is not good.</p>
  
  <pre><code>from flask import Flask,session,url_for,request,redirect,render_template
  import api,db   
  app = Flask(__name__)
  #app.secret_key = "secret"
  
  @app.route('/slideshow/&lt;tag&gt;', methods=['GET', 'POST'])
  def slide():
  if request.method=="GET":
      pic = request.get('current').href
      taglist = db.getTaglist()
      tags = db.getTags(pic)
      piclist = db.getPics(&lt;tag&gt;)
      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)
  </code></pre>