I am using netbeans php 7.3 and cant seem to solve this warning " Expected EOF but found } "
The code is below. Its in a php file.
<script type="text/javascript">
function downloadStats($filename,$album,$type){
$('#downloaddiv').html('<img src="images/ajax-loader.gif" />');
$.ajax({
type: 'POST',
url: 'download.php',
<?php
if($_GET['urltype']=='basketball'){
?>
data: "filename=" + $filename + "&album=" + $album + "&type=" + $type + "&area=source&uploadyear=<?php echo $uploadyear;?>",
<?php
} else {
?>
data: "filename=" + $filename + "&album=" + $album + "&type=" + $type + "&uploadyear=<?php echo $uploadyear;?>",
<?php
}
?>
<?php global $tag; ?>
success: function(msg) {
$('#downloaddiv').html('<b title="Stat available for download. Click HERE to download." ><?php echo $tag['view_013'];?> <?php echo $tag['view_014'];?> <a href="'+msg+'"><?php echo $tag['view_015'];?></a> <?php echo $tag['view_016'];?></b>');
}
}); <=== red circle/exclamation mark here
}
</script>
Netbeans throws up a red circle /exclamation mark on the second last line });
The php file is 600+ lines and so to make matters simple i pasted the code section into a new file and netbeans still threw an error at the same place });
I edited the code, try this now:
<?php
function downloadStats($filename,$album,$type){
?>
$('#downloaddiv').html('<img src="images/ajax-loader.gif" />');
$.ajax({
type: 'POST',
url: 'download.php',
<?php
if($_GET['urltype']=='basketball') :
?>
data: "filename=" + $filename + "&album=" + $album + "&type=" + $type + "&area=source&uploadyear=<?php echo $uploadyear;?>",
<?php
else :
?>
data: "filename=" + $filename + "&album=" + $album + "&type=" + $type + "&uploadyear=<?php echo $uploadyear;?>",
<?php
endif;
global $tag; ?>
success: function(msg) {
$('#downloaddiv').html('<b title="Stat available for download. Click HERE to download." ><?php echo $tag['view_013'];?> <?php echo $tag['view_014'];?> <a href="'+msg+'"><?php echo $tag['view_015'];?></a> <?php echo $tag['view_016'];?></b>');
}
});
<?php
}
?>
<script type="text/javascript">
<?php echo downloadStats($filename,$album,$type); ?>
</script>
About closing and opening php this is what I mean:
This works but is not the bestway:
<?php
endif;
?>
<?php
global $tag; ?>
This works but is much better:
<?php
endif;
global $tag; ?>
Also if posible don't use global see more info about that see this url: https://stackoverflow.com/a/12446305/1788516
Edit
The problem is because there is javascript and php in the same file. for more information see this http://netbeans.org/bugzilla/show_bug.cgi?id=166694 for the bug.