My script part in my php page is like this
<script type="text/javascript" >
alert('Out');
if (<?php echo $delFlag; ?> == 1) {
alert('ting');
}
</script>
While the code below is what I get from the Chrome Developers tool (Resource>XHR) (which I'm using for debugging)
<!-- For javascripts -->
<script type="text/javascript" >
alert('Out');
if (1 == 1) {
alert('ting');
}
</script>
The alerts are not popping up.
What is wrong with my codes??
Update
I've my codes in a file add-line.php
<script type="text/javascript" >
// $(function() {
if (<?php echo $timer; ?> == 1) {
//alert('Line');
var timenow = <?php echo time(); ?>;
var dataPass = 'lineId=' + <?php echo $lineId; ?> + '&storyId=' + <?php echo $storyId; ?> + '&timenow=' + timenow;
$.ajax({
type: "POST",
url: "proc/updateDb.php",
data: dataPass,
cache: false,
success: function(){
// Show error if error is there
}
});
}
// });
</script>
Now in the updateDb.php I m processing some CRUD thing using the POST values and then determine $delFlag value. Then at the end of this file, I've my scripts as (same as the first one above)
<script type="text/javascript" >
alert('Out');
if (<?php echo $delFlag; ?> == 1) {
alert('ting');
}
</script>
But this script is not being executed at all it seems.
Resource>XHR? Do you mean to say you are using ajax?