{"size": 1869, "ext": "js", "max_stars_repo_path": "static/js/advancedSearch.js", "max_stars_repo_name": "Yash-K-B/Ed-Flix", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "static/js/advancedSearch.js", "max_issues_repo_name": "Yash-K-B/Ed-Flix", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "static/js/advancedSearch.js", "max_forks_repo_name": "Yash-K-B/Ed-Flix", "max_forks_repo_forks_event_min_datetime": "2021-02-26T04:36:19.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-26T04:36:19.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 33.375, "max_line_length": 113, "alphanum_fraction": 0.4253611557}
const checkBox = document.querySelector("#adv-search-check");
const label = document.querySelector(".adv-search-label span");

var cards = []

var prev = ""

checkBox.addEventListener("click", () => {
    checkBox.checked ?
        (label.innerHTML = "Advanced Search") :
        (label.innerHTML = "Advanced Search");

    if (checkBox.checked == true) {
        query = "query=" + q;
        console.log(query);
        $.ajax({
            type: "GET",
            url: "/api/advancedSearch",
            data: query, // serializes the form's elements.
            success: function(data) {
                data = JSON.parse(data);
                cards = []
                for (let i = 0; i < data.length; i++) {
                    var card = ` <div class="card advanced">
                    <div class="image-container">
                      <div class="subject-name">
                        <h2>${data[i].title}</h2>
                        <h5>${data[i].subtitle}</h5>
                        <a href="{% url 'contentView' %}?id=${data[i].id}"><span class="read">READ NOW</span></a>
                      </div>
                      <div class="subject-short">${data[i].subject_code}</div>
                    </div>
                    <div class="author">
                      <p>
                        Author:
                        <span class="author-name">${data[i].author}</span> |
                        <span class="author-duration">size: ${data[i].file_size}</span>
                      </p>
                    </div>
                  </div>`;
                    cards.push(card);
                }

                prev = $('.subject-container').html();
                $('.subject-container').html(cards);

            }



        });
    } else {
        $('.advanced').remove();
        $('.subject-container').html(prev);
    }
});