This commit is contained in:
SBD
2023-11-28 16:15:59 +03:00
parent 9cd6eaf060
commit 3cf374c755
2 changed files with 9 additions and 4 deletions

View File

@@ -29,10 +29,14 @@ function sendWidthAjax () {
return data
}
function renderContent () {
function renderContent (el=null) {
let data = sendWidthAjax()
let section_button = document.querySelector(".section_btn")
data['section_url'] = section_button.dataset['url']
if (!el) {
let section_button = document.querySelector(".section_btn")
data['section_url'] = section_button.dataset['url']
} else {
data['section_url'] = el.dataset['url']
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/get_content_for_section/',
@@ -79,6 +83,7 @@ function replaceHrefOnOnclick () {
str = str.replace(str_f_replace,'')
str = str.replace('"target="_blank""','')
cur_el.outerHTML = str
cur_el.setAttribute("onclick",`renderContent(this)`)
}
i++
})