How to refresh a div tag after an AJAX call using jQuery in a Spring boot application? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?How to manage a redirect request after a jQuery Ajax callHow to replace innerHTML of a div using jQuery?jQuery: Return data after ajax call successHow can I refresh a page with jQuery?Keep jquery animate when refreshing AJAX contentHow to configure port for a Spring Boot applicationCannot display HTML stringCall Jquery function after Drupal ajax updateJQuery Div Tag Code

Where is the Data Import Wizard Error Log

Semigroups with no morphisms between them

How to pronounce 伝統色

Random body shuffle every night—can we still function?

Do I really need to have a message in a novel to appeal to readers?

What order were files/directories output in dir?

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode

What is the difference between a "ranged attack" and a "ranged weapon attack"?

How would a mousetrap for use in space work?

Why is it faster to reheat something than it is to cook it?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

How to write capital alpha?

Sliceness of knots

Lagrange four-squares theorem --- deterministic complexity

Why are my pictures showing a dark band on one edge?

How do living politicians protect their readily obtainable signatures from misuse?

Is multiple magic items in one inherently imbalanced?

Draw 4 of the same figure in the same tikzpicture

macOS: Name for app shortcut screen found by pinching with thumb and three fingers

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Unit testing extension method adding view location expander

Do wooden building fires get hotter than 600°C?

How does a spellshard spellbook work?

A term for a woman complaining about things/begging in a cute/childish way



How to refresh a div tag after an AJAX call using jQuery in a Spring boot application?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?How to manage a redirect request after a jQuery Ajax callHow to replace innerHTML of a div using jQuery?jQuery: Return data after ajax call successHow can I refresh a page with jQuery?Keep jquery animate when refreshing AJAX contentHow to configure port for a Spring Boot applicationCannot display HTML stringCall Jquery function after Drupal ajax updateJQuery Div Tag Code



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I want to refresh a div tag after an AJAX call in a Spring boot app using jQuery. I used the load() method of jQuery but it will call mapping method of the controller layer. I want to refresh it without calling the controller. Is this possible?



<div id="instructor-block-wrapper" class="row inner_sec_info pt-md-4">
<div id="details-details-block" class="col-lg-8 single-left">
<ul>
<li style="font-size: 120%" class="mt-3">
<a href="">First Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.firstName"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Last Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.lastName"></a>
</li>
<li style="font-size: 120%" class="mt-3 ">
<i class="fas fa-check mr-2"></i>
<a href="">Register No</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.registerationNumber"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Degree</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.degree"></a>
</li>
</ul>
</div>
</div>


$(document).on('click', '#searchInsructorButton', function(event) 
event.preventDefault();
var registerNo = $("#search-instructor-pattern").val();
$.ajax(
type: "GET",
url: "/instructor/search-instructor?regno=" + registerNo,
success: function(result)
if (result.status)
$("#instructor-block-wrapper").load(location.href + ' #instructor-block-wrapper')
else
$("#search-wrong-msg-instructor").text("Instructor not exist");
return;

,
error: function()
alert("Error! please enter proper data");

);
);









share|improve this question
























  • Where would you refresh it from without using the controller?

    – JensV
    Mar 22 at 10:59











  • when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

    – Merwais Muafaq
    Mar 22 at 11:15

















1















I want to refresh a div tag after an AJAX call in a Spring boot app using jQuery. I used the load() method of jQuery but it will call mapping method of the controller layer. I want to refresh it without calling the controller. Is this possible?



<div id="instructor-block-wrapper" class="row inner_sec_info pt-md-4">
<div id="details-details-block" class="col-lg-8 single-left">
<ul>
<li style="font-size: 120%" class="mt-3">
<a href="">First Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.firstName"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Last Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.lastName"></a>
</li>
<li style="font-size: 120%" class="mt-3 ">
<i class="fas fa-check mr-2"></i>
<a href="">Register No</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.registerationNumber"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Degree</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.degree"></a>
</li>
</ul>
</div>
</div>


$(document).on('click', '#searchInsructorButton', function(event) 
event.preventDefault();
var registerNo = $("#search-instructor-pattern").val();
$.ajax(
type: "GET",
url: "/instructor/search-instructor?regno=" + registerNo,
success: function(result)
if (result.status)
$("#instructor-block-wrapper").load(location.href + ' #instructor-block-wrapper')
else
$("#search-wrong-msg-instructor").text("Instructor not exist");
return;

,
error: function()
alert("Error! please enter proper data");

);
);









share|improve this question
























  • Where would you refresh it from without using the controller?

    – JensV
    Mar 22 at 10:59











  • when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

    – Merwais Muafaq
    Mar 22 at 11:15













1












1








1








I want to refresh a div tag after an AJAX call in a Spring boot app using jQuery. I used the load() method of jQuery but it will call mapping method of the controller layer. I want to refresh it without calling the controller. Is this possible?



<div id="instructor-block-wrapper" class="row inner_sec_info pt-md-4">
<div id="details-details-block" class="col-lg-8 single-left">
<ul>
<li style="font-size: 120%" class="mt-3">
<a href="">First Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.firstName"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Last Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.lastName"></a>
</li>
<li style="font-size: 120%" class="mt-3 ">
<i class="fas fa-check mr-2"></i>
<a href="">Register No</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.registerationNumber"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Degree</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.degree"></a>
</li>
</ul>
</div>
</div>


$(document).on('click', '#searchInsructorButton', function(event) 
event.preventDefault();
var registerNo = $("#search-instructor-pattern").val();
$.ajax(
type: "GET",
url: "/instructor/search-instructor?regno=" + registerNo,
success: function(result)
if (result.status)
$("#instructor-block-wrapper").load(location.href + ' #instructor-block-wrapper')
else
$("#search-wrong-msg-instructor").text("Instructor not exist");
return;

,
error: function()
alert("Error! please enter proper data");

);
);









share|improve this question
















I want to refresh a div tag after an AJAX call in a Spring boot app using jQuery. I used the load() method of jQuery but it will call mapping method of the controller layer. I want to refresh it without calling the controller. Is this possible?



<div id="instructor-block-wrapper" class="row inner_sec_info pt-md-4">
<div id="details-details-block" class="col-lg-8 single-left">
<ul>
<li style="font-size: 120%" class="mt-3">
<a href="">First Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.firstName"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Last Name</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.lastName"></a>
</li>
<li style="font-size: 120%" class="mt-3 ">
<i class="fas fa-check mr-2"></i>
<a href="">Register No</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.registerationNumber"></a>
</li>
<li style="font-size: 120%" class="mt-3">
<i class="fas fa-check mr-2"></i>
<a href="">Degree</a><i style="color: red;"> : </i>
<a th:text="$session.instructorToDisplay.degree"></a>
</li>
</ul>
</div>
</div>


$(document).on('click', '#searchInsructorButton', function(event) 
event.preventDefault();
var registerNo = $("#search-instructor-pattern").val();
$.ajax(
type: "GET",
url: "/instructor/search-instructor?regno=" + registerNo,
success: function(result)
if (result.status)
$("#instructor-block-wrapper").load(location.href + ' #instructor-block-wrapper')
else
$("#search-wrong-msg-instructor").text("Instructor not exist");
return;

,
error: function()
alert("Error! please enter proper data");

);
);






jquery html spring-boot thymeleaf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 10:56









Rory McCrossan

251k29218255




251k29218255










asked Mar 22 at 10:53









Merwais MuafaqMerwais Muafaq

61




61












  • Where would you refresh it from without using the controller?

    – JensV
    Mar 22 at 10:59











  • when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

    – Merwais Muafaq
    Mar 22 at 11:15

















  • Where would you refresh it from without using the controller?

    – JensV
    Mar 22 at 10:59











  • when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

    – Merwais Muafaq
    Mar 22 at 11:15
















Where would you refresh it from without using the controller?

– JensV
Mar 22 at 10:59





Where would you refresh it from without using the controller?

– JensV
Mar 22 at 10:59













when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

– Merwais Muafaq
Mar 22 at 11:15





when I search for an item using ajax call i reinitialized the session instructorToDisplay value with new object but after ajax call it will still show the previous item.

– Merwais Muafaq
Mar 22 at 11:15












2 Answers
2






active

oldest

votes


















1














You can use following in you response



$('#showresults').html($('#showresults',data).html());


or



$('#showresults').replaceWith($('#showresults',data));





share|improve this answer























  • Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

    – Merwais Muafaq
    Mar 22 at 11:18











  • Data is representing your data if you need to update any ?

    – Zahid Rahman
    Mar 22 at 11:20











  • But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

    – Merwais Muafaq
    Mar 22 at 11:27


















0














In response try add:



$("#yourdivid").load(" #yourdivid");


P.S. Leve that space in there " #yourdivid"






share|improve this answer

























  • I tried tried .still not working

    – Merwais Muafaq
    Mar 22 at 11:11











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298066%2fhow-to-refresh-a-div-tag-after-an-ajax-call-using-jquery-in-a-spring-boot-applic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You can use following in you response



$('#showresults').html($('#showresults',data).html());


or



$('#showresults').replaceWith($('#showresults',data));





share|improve this answer























  • Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

    – Merwais Muafaq
    Mar 22 at 11:18











  • Data is representing your data if you need to update any ?

    – Zahid Rahman
    Mar 22 at 11:20











  • But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

    – Merwais Muafaq
    Mar 22 at 11:27















1














You can use following in you response



$('#showresults').html($('#showresults',data).html());


or



$('#showresults').replaceWith($('#showresults',data));





share|improve this answer























  • Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

    – Merwais Muafaq
    Mar 22 at 11:18











  • Data is representing your data if you need to update any ?

    – Zahid Rahman
    Mar 22 at 11:20











  • But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

    – Merwais Muafaq
    Mar 22 at 11:27













1












1








1







You can use following in you response



$('#showresults').html($('#showresults',data).html());


or



$('#showresults').replaceWith($('#showresults',data));





share|improve this answer













You can use following in you response



$('#showresults').html($('#showresults',data).html());


or



$('#showresults').replaceWith($('#showresults',data));






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 11:10









Zahid RahmanZahid Rahman

111




111












  • Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

    – Merwais Muafaq
    Mar 22 at 11:18











  • Data is representing your data if you need to update any ?

    – Zahid Rahman
    Mar 22 at 11:20











  • But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

    – Merwais Muafaq
    Mar 22 at 11:27

















  • Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

    – Merwais Muafaq
    Mar 22 at 11:18











  • Data is representing your data if you need to update any ?

    – Zahid Rahman
    Mar 22 at 11:20











  • But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

    – Merwais Muafaq
    Mar 22 at 11:27
















Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

– Merwais Muafaq
Mar 22 at 11:18





Zahid Rahman thanks from your answer .but what is data here.I mean I save the data in session and from session i will display it.

– Merwais Muafaq
Mar 22 at 11:18













Data is representing your data if you need to update any ?

– Zahid Rahman
Mar 22 at 11:20





Data is representing your data if you need to update any ?

– Zahid Rahman
Mar 22 at 11:20













But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

– Merwais Muafaq
Mar 22 at 11:27





But here i am displaying data from session.and after searching an item i reinitialize session data. can you look at the code once

– Merwais Muafaq
Mar 22 at 11:27













0














In response try add:



$("#yourdivid").load(" #yourdivid");


P.S. Leve that space in there " #yourdivid"






share|improve this answer

























  • I tried tried .still not working

    – Merwais Muafaq
    Mar 22 at 11:11















0














In response try add:



$("#yourdivid").load(" #yourdivid");


P.S. Leve that space in there " #yourdivid"






share|improve this answer

























  • I tried tried .still not working

    – Merwais Muafaq
    Mar 22 at 11:11













0












0








0







In response try add:



$("#yourdivid").load(" #yourdivid");


P.S. Leve that space in there " #yourdivid"






share|improve this answer















In response try add:



$("#yourdivid").load(" #yourdivid");


P.S. Leve that space in there " #yourdivid"







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 22 at 11:05

























answered Mar 22 at 10:59









IngusIngus

568422




568422












  • I tried tried .still not working

    – Merwais Muafaq
    Mar 22 at 11:11

















  • I tried tried .still not working

    – Merwais Muafaq
    Mar 22 at 11:11
















I tried tried .still not working

– Merwais Muafaq
Mar 22 at 11:11





I tried tried .still not working

– Merwais Muafaq
Mar 22 at 11:11

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298066%2fhow-to-refresh-a-div-tag-after-an-ajax-call-using-jquery-in-a-spring-boot-applic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript