Javascript function called from php does not execute

I am correcting some bugs in a web page that uses php and javascript, which is hosted on a debian machine and was working correctly before, but when migrating to the latest version of debian, some screens are not working.

Specifically, in one of the screens that do not work correctly, this “php” is executed:

<link href="style1.css" rel="stylesheet" type="text/css" />
<?php 	
	Yii::app()->clientScript->registerCoreScript('jquery'); 
	Yii::app()->clientScript->registerCoreScript('jquery.ui');

  // Sets the value of: $var1, $var2, $var3, $var4, $var5, $var6 and $var7
?>

<script type="text/javascript" >
	jsonVar = eval(<?php echo $var2;?>);
	$(document).ready(function() {
		function1('<?php echo var1; ?>',
						  '<?php echo $var7; ?>',
						  '<?php echo $var3; ?>',
						  '<?php echo $var4; ?>',
						  '<?php echo $var5; ?>',
						  '<?php echo $var6; ?>',
						  jsonVar );
	});
</script>

<div id="content" >
	<form method="post">
		<table class="ptable" >
				<tr class="prow"  > 
					<th class="ptable1" colspan="3" ><?php echo "$this->title"; ?></th>
				</tr>
				
				<tr class="prow" >
					<td class="ptable2" ><?php echo "$this->InfoName1"; ?></td>
					<td class="ptable2" ><?php echo "$this->InfoName2"; ?></td>
				</tr>
				
				<tr class="prow" >
					<td class="pinfo" id="p1" >INFO 1</td>
					<td class="pcell1" id="col1-p1" ></td>
					<td class="pcell1" id="col2-p1" >Default ...</td>
				</tr>
		
				<tr class="prow" >
					<td class="pinfo" id="p2" >INFO 2</td>
					<td class="pcell1" id="col1-p2" ></td>
					<td class="pcell1" id="col2-p2" >Default ...</td>
				</tr>
		
        // . . .
				
		</table>
	</form>
</div>
</div>

Although I do not have much knowledge about php and javascript, in view of the source code of this php, I understand that
during the load of the same the call to the function function1 should be executed

The code for this function is found in the file js/tabInfo.js

I have added at the beginning of it the line of code

   debugger;

being that way:

	window.function1 = function (parameter1, parameter2, parameter3, parameter4,
										          parameter5, parameter6, parameter7 )
	{
    debugger;

    // Rest of function code.
    // . . .
	};

If we now open the Firebug “Debugger” tab, when the web browser enters the code of said function, the execution will stop and a step-by-step execution will be possible, checking the value of variables and what flow the execution follows.

However, when I load the page with the “Debugger” tab open, as I mentioned, I verify that the browser is not actually entering the code of this function.

I have tried to modify the source code of the php leaving it in this form:

<link href="style1.css" rel="stylesheet" type="text/css" />
<?php 	
	Yii::app()->clientScript->registerCoreScript('jquery'); 
	Yii::app()->clientScript->registerCoreScript('jquery.ui');

  // Sets the value of: $var1, $var2, $var3, $var4, $var5, $var6 and $var7

echo "<script type='text/javascript' >
	jsonVar = eval(<?php echo $var2;?>);
	$(document).ready(function() {
		function1('<?php echo var1; ?>',
						  '<?php echo $var7; ?>',
						  '<?php echo $var3; ?>',
						  '<?php echo $var4; ?>',
						  '<?php echo $var5; ?>',
						  '<?php echo $var6; ?>',
						  jsonVar );
	});
</script>";

?>

// . . .

However, the code execution of function1 still does not appear in Firebug.

Any comment or help is appreciated.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.