Click here to Skip to main content
15,924,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this button and function

HTML
<button class="btn btn-primary booking-btn text-uppercase" data-hotel-id='${hotel.id}'>Book Now</button>


JavaScript
$('body').on('click', '.btn-primary', function () {
                           
                            const hotelId = $(this).attr('data-hotel-id')
                            
                            $.cookie('id', hotelId);
                            window.location.href = 'booking-form?id=' + hotelId;

                                                    
                            })


But I get 404 error.
Request URL: http://localhost:8080/booking-form?id=2
Request Method: GET
Status Code: 404 


What I have tried:

I have searched the web for a solution that may work for me but no luck.
Posted
Comments
Richard MacCutchan 18-Dec-21 3:45am    
Check your server code to see why the page was not found.
Member 15471521 18-Dec-21 9:35am    
you are right, I found my mistake! Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900