/gist:e9334006ec3c7419bb87 Secret
Last active
August 29, 2015 14:23
-
-
Save teresko/e9334006ec3c7419bb87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--1st select box--> | |
<td class="h_c"> | |
<select name="strtpnt" id="strtpnt" class="inp_bx" onChange="ajaxcall(this.value)"> | |
<option>-Select-</option> | |
<?php | |
$sql = "select distinct(start) from tbl_place"; | |
$retval = mysql_query($sql, $conn ); | |
while($row = mysql_fetch_assoc($retval,MYSQL_ASSOC)){ $strtpnt= $row['start'];?> | |
<option value="<?php echo $strtpnt;?>"><?php echo $strtpnt;?></option> | |
<?php } ?> | |
</select> | |
<!--2nd select box--><td class="hc"> | |
<select name="destination" id="destination" class="inp_bx"> | |
<option>-Select-</option> | |
</select></td> | |
<!--3rd select box--> | |
<select name="duration" id="duration" class="inp_bx" onchange="textHint();"> | |
<option value="1">-Select-</option> | |
<?php | |
$sql = "select distinct(package_type) from tbl_package"; | |
$retval = mysql_query($sql, $conn ); | |
while($row = mysql_fetch_assoc($retval,MYSQL_ASSOC)){ $package= $row['package_type'];?> | |
<option value="<?php echo $package?>"><?php echo $package;?></option> | |
<?php } ?> | |
</select> | |
///Now the ajax calls | |
<script type="text/javascript"> | |
function textHint() { | |
//alert("valar morghulis .arya"); | |
var start=$("#strtpnt").val(); | |
var destin=$("#destination").val(); | |
var ans=confirm("Do you want to continue touring"); | |
if(ans) { | |
alert("Enjoy the tour visiting various places"); | |
$.post('tour.php', { start:start,destin:destin}, function(response) { | |
console.log(response); | |
$('.h_c').html(response); | |
}); | |
} else { | |
window.Location="http://localhost/tpc_new/home1.php"; | |
} | |
return false; | |
} | |
function ajaxcall(type) { | |
var parameters = 'data='+type; | |
var argUrl = 'ajax_data.php';//alert(parameters); | |
$.ajax({ | |
url: argUrl, | |
type: 'POST', | |
data: parameters, | |
success: function (str) { | |
$(".hc").html(str); | |
alert(parameters); | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment