php - I have three div's, how to refresh a second div without reloading the complete page? -
i have 3 div tags, on click of link want reload second div tag instead of loading complete page, want keep first , third div tag static , second div tag should dynamic?
<div class="first"> <a href="patientlogin/patientvisit_details/<?php echo $data->patient_visit_id;?>"><?php echo $data->hospital_name;?></a> </div> <div class ="second"> //content// <div> <div class ="third"> //content// <div>
first of should make difference between divs making ids unique billy said in comment. classes used make common selector elements. create html below:
<div id="first"> <a href="patientlogin/patientvisit_details/<?php echo $data->patient_visit_id;?>"><?php echo $data->hospital_name;?></a> </div> <div id="second"> //content// <div> <div id="third"> //content// <div>
now load data in particular div, can use ajax request in 3 ways using jquery.
$('#second').load("load.php");
or
$.post('load.php?param=value',function(data){ $('#second').html(data); });
or
$.get('load.php?param=value',function(data){ $('#second').html(data); });
or
$.ajax({ url:"load.php"; data: yourdataobject, success: function(data){ $('#second').html(data); } });
hope above little
Comments
Post a Comment