Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks
update page data without reload

How to update page data without reload in jQuery?

Aman Jain, October 24, 2021November 17, 2023

If you are beginner then this post is for you. For showing the new content on page without refresh we will use JQuery Reload Page without Refresh and server side PHP. In this article, I will demonstrate to show the latest content from server without refreshing the page. This is useful in case of showing like unlike button, showing latest content, changing the data on user request.

In this tutorial we will take example of JQuery Reload Page without Refresh and Changing content of element on click and check status.

Let’s start the tutorial with steps:

Step 1: Create a html file

First step is to create the html and setup basic elements of page.

<!DOCTYPE html>
<html>
<body>

<h2>Change content without reloading page - Readerstacks.com</h2>

<div id="content">
  <h1>This is a dummy content, i am going to change it</h1>
  <p>Let's change it with jquery click</p>
</div>
<div class="footer">
  <button id="load_btn">Load New </button>
</div>
</body>
</html>

Step 2: Add jQuery

So, we are going to use jQuery to update the content

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

Step 3: Add jQuery code to change content

We have created content and included jQuery , so now it’s time to apply the logic

<script>
$(function(){
  $("#load_btn").click(function(){
        $("#content").load("http://localhost/refresh_page_jquery/new_dynamic_content.php");
   });
});
</script>

Here, we added click event to load_btn and using load method of query to change the content. we can also append some fragment of loaded content using below example

$( "#content" ).load( "ajax/test.html #new_content" );

Using get or post method to update the content

<script>
$(function(){
   
   $("#load_btn").click(function(){
       $.get('http://localhost/refresh_page_jquery/new_dynamic_content.php',function(data){
         $('#content').html(data);
       })  
   });
  
});
</script>

Below is the live screenshot

Screenshot 2021 10 24 at 5.04.33 PM 1
Screenshot 2021 10 24 at 5.04.42 PM
Screenshot 2021 10 24 at 5.05.03 PM
update page data without reload

Related

Uncategorized Javascript jQuery

Post navigation

Previous post
Next post

Related Posts

Javascript Laravel Customized Autocomplete JQuery UI

Laravel Customized Autocomplete JQuery UI

July 12, 2022July 12, 2022

Laravel Customized Autocomplete JQuery UI is useful when we want live search of bulk data. Autocomplete search is mostly work of javascript and when we want to fetch live data from database then we require the intervention of laravel to provide the data in json response. In this tutorial we…

Read More
Javascript Laravel Multi Select Tag Autocomplete Using Select2

Laravel Multi Select Tag Autocomplete Using Select2

July 19, 2022July 19, 2022

In this article we will learn to use Laravel Multi Select Tag Autocomplete Using Select2. Select2 is useful when we want live search of bulk data or to convert the existing select boz with multi features like search, multi select and options customizations. In this article we will cover multiple…

Read More
Javascript Angular Keypress Event on Input Example

Angular Keypress Event on Input Example ?

September 21, 2022March 16, 2024

Input events in angular can be handled using input and output decorators and in this tutorial we will learn Angular Keypress Event on Input with Example. In core javascript we use onkeypress event to handle the key events of input but in angular it there is different way to handle…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • Understanding High Vulnerabilities: A Closer Look at the Week of July 14, 2025
  • Exploring Fresh Resources for Web Designers and Developers
  • The Intersection of Security and Technology: Understanding Vulnerabilities
  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version