How can you output the values in the same page?

I’m trying to build an email scraper on Django and that when you enter a URL, the result should be outputted in the same page. For now, the result is outputted in another page but I want it to be in the same one. I don’t know how should I do this.

I know I should be using an AJAX request but don’t know how to make the form take the action of the AJAX request.

Any help I would really appreciate it!

form:

<form class="card card-sm" action="{% url 'emailsearcher' %}" id='InputSearch' method="GET">
    <div class="card-body row no-gutters align-items-center">
        <div class="col-auto">
            <i class="fas fa-search h4 text-body"></i>
        </div>
        <!--end of col-->
        <div class="col">
            <input type="text" class="form-control form-control-lg form-control-borderless" placeholder="Introduce URL" name="Email" id="InputSearch" value="{{ Email.get }}" aria-describedby="searchHelp">
        </div>
        <!--end of col-->
        <div class="col-auto">
            <button class="btn btn-lg btn-success" type="search" onclick="total()">Find Email Address</button>
        </div>
        <!--end of col-->
    </div>
</form>

37 thoughts on “How can you output the values in the same page?”

Leave a Comment