Anonymous Anonymous - 6 days ago
118 0

No description

Python

PY123123

@app.route('/old_result', methods=['POST', 'GET'])
def old_search():
	search_id = request.args.get('search_id')
	keyword = request.args.get('keyword')
	date_time = request.args.get('date')
	username = request.args.get('username')
	with db_lock:
		query_data_list = slise_db_api.get_specific_search(search_id)
	return render_template('old_search.html', keyword = keyword, query_data = query_data_list, username = session['username'], date_time = date_time)
Javascript

JS123123123

$(".old-search").click(
	function() {
		var list = $(this).children("a").children("span");
		var id = list[2].textContent;
		var date = list[0].textContent;
		var username = list[1].textContent;
		var keyword = list[3].textContent;
		window.open("/old_result?search_id=" + id + "&date=" + date + "&username=" + username + "&keyword=" + keyword)
	});
HTML

HTML1231231

<div class="dropdown">
    <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{{ previous_searches|length }} earlier searches on {{ keyword }}
      <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
      {% for search in previous_searches[::-1] %}
      <li class="old-search"><a href="#"><span>{{ search[4] }}</span> by 
      <span>{{ search[1] }}</span> {{ search[2] }} {{ '#' }} {{ search[3] }}
      <span class="hidden">{{search[0]}}</span>
      <span class="hidden"> {{keyword}}</span></a></li>
      {% endfor %}
    </ul>
  </div>