How can I change the page URL without refreshing the page

0 votes
I've built a website and I want to implement AJAX and JQuery in one of my pages. The problem is; when I load the content, the URL doesn't change.

Let's say that I have the URL http://www.example.com/controller/function/param
And another URL : http://www.example.com/controller/function/param2

How can I change the first URL to the second one when I click a button?
Jun 18, 2020 in Java-Script by kartik
• 37,520 points
6,594 views

1 answer to this question.

0 votes

Hello @kartik,

This is simple you just need change the URL In HTML5 as :

window.history.pushState("object or string", "Title", "/new-url");

Hope this is helpful!

Thank You!!

answered Jun 18, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

0 votes
1 answer

How to change url after success in ajax without page reload?

Hello @kartik, Use the browser history to change ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,880 points
9,742 views
0 votes
1 answer

How can I update NodeJS and NPM to the next versions?

Hello @kartik, First check your NPM version npm -v 1).Update ...READ MORE

answered May 5, 2020 in Java-Script by Niroj
• 82,880 points
941 views
0 votes
1 answer

How to implement useEffect() so the list on the front page updates only when a name change has been detected?

Hello @kartik, Instead of passing the entire object ...READ MORE

answered Jun 1, 2020 in Java-Script by Niroj
• 82,880 points
930 views
0 votes
1 answer

How can I get the user's local time instead of the server's time?

Hello @kartik, For client side, you would need ...READ MORE

answered Jul 7, 2020 in Java-Script by Niroj
• 82,880 points
618 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
22,837 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,917 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,852 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
44,089 views
0 votes
1 answer

How can we change the page URL without refreshing the page?

Hello @kartik,  In HTML5 you can change the ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
1,367 views
0 votes
1 answer

How do I modify the URL without reloading the page?

Hii @kartik, HTML5 introduced the history.pushState() and history.replaceState() methods, which allow you ...READ MORE

answered Jun 20, 2020 in Java-Script by Niroj
• 82,880 points
5,389 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP