javascript - Refreshing a Specific Section of a Page -
i have modal deletes item list of data. after selecting delete, want refresh web page. @ point, refreshing entire page , re-directing me searches
tab. want refresh lists
tab. how can this?
my html:
<div class="row zero-margin"> <div class="col-xs-12"> <div id="tabstrip"> <ul id="tab-strip-options"> <li id="listitem1" class="k-state-active"> searches </li> <li id="listitem2"> lists </li> </ul> <div class="saved-search-content"> <div id="gridsearch"></div> </div> <div class="saved-list-content"> <div id="gridlist"></div> </div> </div> </div> </div>
my javascript function:
function deleteitemsfromlist(data) { if(data.issuccess) { window.location.reload(); closemodal("deletesearchlistmodal"); showsuccessmessage('list deleted!'); } }
solution server side data store:
the easiest solution partial update on web page use ajax requests. must load list content web source, when update it.
$( "#gridlist" ).load( "ajax/getlistcontent" );
of course ajax/getlistcontent
must generate proper html substructure (without html, body tags) like:
<div>...</div>
generally create data source on address ajax/getlistcontent
return data structured in html, in code can this:
function deleteitemsfromlist(data) { if(data.issuccess) { $( "#gridlist" ).load( "ajax/getlistcontent", function() { closemodal("deletesearchlistmodal"); showsuccessmessage('list deleted!'); } } }
Comments
Post a Comment