bug^君 2017-09-30 05:35 采纳率: 25%
浏览 130

python flask jquery获取问题

What is the mystery of this Web Server issue.

Here is my code its work well on local server, but in the Web Server it's doesn't work:

$.ajax({
      url: "/flask/templates/table.html",
      type: "get",
      data: {jsdata: $( "#select option:selected" ).text()},
      success: function(response) {
        $("#place_for_suggestions").html(response);

      },
      error: function(xhr) {
        // handle error
      }
    });

The flask side:

@FlaskApp2.route('/flask/templates/table.html', methods=['GET', 'POST'])
def table():

    modid = request.args.get('jsdata')

    print "Hello!!!!!!!!!!!!!!!!", modid 
    return render_template('table.html')

I try to see any activity in @FlaskApp2.route but I see only silent !

What is wrong with this code?

  • 写回答

1条回答

  • 衫裤跑路 2017-09-30 23:28
    关注

    The verbs of the methods=['GET','POST'] are case sensitive when matching your route. So in your .ajax use method: 'GET' instead of type: 'get'. On later versions of jquery type has been replaced by method.

    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果