Hi,
Ajax function display a main page of index.php inside
[php]// php code
if ($_POST) {
require(‘db.php’);
$district = $_POST[‘district’];
if ($country != ‘’) {
$sql1 = “SELECT * FROM zone WHERE districtid=” . $district;
$result1 = mysqli_query($con, $sql1);
echo “”;
echo “Select”;
while ($row = mysqli_fetch_array($result1)) {
echo “<option value=’” . $row[‘zone_id’] . “’>” . $row[‘zone’] . “”;
}
echo “”;
} else {
echo ‘’;
}
}
// At index.php main page
while ($row = mysqli_fetch_array($resultdistrict)) {
echo “<option selected=‘selected’ value=’” . $row[‘districtid’] . “’>” . $row[‘districtname’] . “”;
}
// This is Ajax
function change_zone() { // Call to ajax function
var country = $(’#district’).val();
var dataString = “district=” + district;
$.ajax({
type: “POST”,
url: “index.php”, // Name of the php files
data: dataString,
success: function (html)
{
$("#get_zone").html(html);
}
}); // END OF AJAX FUNCTION:
}[/php]
How this happen and please advice how to avoid it happen.
Thanks