我有一个来自数据库的id的链接。当我点击它时,如何通过向他们申请相同的ID来将此ID复制到2个按钮?看哪我尝试:
$('.godown').click(function() {
var godown = $(this).attr('id');
// How can I copy the variable **godown ** to the buttons so that they have the save id as godown ?
});
JQUERY
from flask import Flask, request, send_file, Response, make_response
from flask_restful import Resource, Api
import matplotlib.pyplot as plt
from io import StringIO, BytesIO
import numpy as np
import json
import random
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import pandas as pd
app = Flask(__name__)
api = Api(app)
app.debug = True
class Graph(Resource):
def get(self):
fig = Figure()
axis = fig.add_subplot(1, 1, 1)
xs = range(100)
ys = [random.randint(1, 50) for x in xs]
axis.plot(xs, ys)
canvas = FigureCanvas(fig)
output = BytesIO()
canvas.print_png(output)
response = make_response(output.getvalue())
response.mimetype = 'image/png'
return response
class PltGraph(Resource):
def get(self):
fig = Figure()
xs = range(100)
ys = [random.randint(1, 50) for x in xs]
plt.plot(xs,ys)
plt.ylabel("Y label")
plt.xlabel("X label")
plt.title("x and y")
canvas = FigureCanvas(fig)
output = BytesIO()
canvas.print_png(output)
response = make_response(output.getvalue())
response.mimetype = 'image/png'
print(response)
return response
api.add_resource(Graph,'/Graph.png')
api.add_resource(PltGraph,'/PltGraph.png')
app.run(host='0.0.0.0', port= 81)
由于