javascript - Reload an AJAX loaded page after update -
i'm trying understand how dynamic page loaded ajax can reloaded after 1 of records updated. i've got following jquery script on page.
<script type="text/javascript"> function showuser(str) { if (str == "") { $("#txthint").empty(); return; } $("#txthint").load("data_ajax.php?q=" + str); } $(document).ready(function () { $("#txthint").delegate(".update_button", "click", function () { var id = $(this).attr("id"); var datastring = 'id='+ id ; var parent = $(this).parent(); $.ajax({ type: "post", url: "data_update_ajax.php", data: datastring }); return false; }); }); </script>
i thought done code below if call within data_ajax.php page after loads corresponding data database, refreshes whole page.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#ref_butn").click(function(){ location.reload(); }); }); </script>
i know can done, not sure turn after searching answer while.
you did populate it:
$("#txthint").load("data_ajax.php?q=" + str);
that load "new" ajax , overwrite what's inside #txthint it.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#ref_butn").click(function(){ //location.reload(); $("#txthint").load("data_ajax.php?q=" + str); // don't know str comes from, idea. }); }); </script>
Comments
Post a Comment