- var $input = $('#id_title');
- var $box = $('#ask-related-questions');
- var template = $('#question-summary-template').html()
-
- function reload_suggestion_box(q) {
- $.post('{% url related_questions %}', {title: q}, function(data) {
- if (data) {
- var html = '';
- for (var i = 0; i < data.length; i++) {
- var item = template.replace(new RegExp('%URL%', 'g'), data[i].url)
- .replace(new RegExp('%SCORE%', 'g'), data[i].score)
- .replace(new RegExp('%TITLE%', 'g'), data[i].title)
- .replace(new RegExp('%SUMMARY%', 'g'), data[i].summary);
-
- html += item;