I have column name status in Database it contains values(0,1) ,in front end i have image if i click the image it will redirect to the next page i am using ajax here, what i want before redirect it should perform if condition i want to check the database column status if the column contain any row '1' it should redirect if all rows in column '0' its not checking the if condition it will redirecting can anyone guide me how to perform this .below is my code(i.e now in row status all values are 0 it will not redirect it want to show alert but its redirecting)
html
<img id='redirect' src="/image/exporttt.png" style="margin:-30 0 0 0px;cursor:pointer;" >
$sql_selectsupplier = "********";
$result1 = mysql_query($sql_selectsupplier);
while($rows=mysql_fetch_array($result1))
{
$reditect=$rows['status'];
}
Ajax
<script>
$(document).ready(function() {
$("#redirect").click(function() {
if($reditect=1){
var clientid=document.getElementById("client").value;
$.blockUI(
{
message: '<h2>Please wait...</h2><img src="/image/loader.gif" />',
timeout: 2000
});
$.ajax({
type:"post",
data:"clientid="+clientid,
success:function(data){
window.location = '?action=clientroutingchange&clientid='+clientid+'';
$("#result").html(data);
$('.blockUI').hide();
}
});
}
else{
alert("no changes made")
}
});
});
</script>