asuscu
asuscu

Reputation: 225

How to trigger a webpage in a post request in NodeJS?

Bellow is the code I want to request a post method like /zamansecimi and I want to open a page like rapor.ejs according to data from /zamansecimi.

How can I do this?

<form  method="post" action="/zamansecimi"  >
    <div class="form-group">
        <label for="ad">Başlangıç</label>
        <input type="date" class="form-control" name="baslangic" id="baslangic"  placeholder="" required>
    </div>
    <div class="form-group">
        <label for="soyad">Bitiş</label>
        <input type="date" class="form-control" name="bitis" id="bitis" placeholder="" required>
    </div>            
    <div class="box-footer">
        <button type="submit" value="rapor" class="btn btn-primary">Göster</button>
    </div>

      </div> 
   </div>
</form>

Upvotes: 0

Views: 260

Answers (1)

Daniel
Daniel

Reputation: 2531

Your backend will need to respond with a redirect when the endpoint (/zamansecimi) is called.

If you are using express you can the doc here https://expressjs.com/en/api.html#res.redirect

Upvotes: 1

Related Questions