Reputation: 89
I have a php file as given below. The page generates html content which is actually made of 3 html pages. I am using jquery tabs to put the three html pages in to tabs. The tab generation takes place in a function "loadtabs" which is called inside script tags at the bottom of the page. The problem i face is that the function i use to generate tabs is not executing in the php .Kindly help me figure out the problem.
editor.php
<html>
<head>
<link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />
<link type="text/css" href="./methodeditor.css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"></script>
<script>
function loadtabs() {
$( ".tabs" ).tabs();
method = <? echo $method; ?>;
mode = <? echo $mode; ?>;
$("#oven").load('oven.php');
$("#detectors").load('detectors.php');
$("#inlets").load('inlets.php');
}
</script>
</head>
<body>
<form id="editor" action="method.php" method="POST" >
<div class="editor">
<div class="tabs">
<ul>
<li><a href="#oven">Oven</a></li>
<li><a href="#detectors">Detectors</a></li>
<li><a href="#inlets">Inlets</a></li>
</ul>
<div id="oven" ></div>
<div id="detectors" ></div>
<div id="inlets"> </div>
</div>
<script>
loadtabs();
</script>
</form>
</div>
</body>
</html>
Upvotes: 0
Views: 56
Reputation: 641
In JQuery, there is a .load which is a shortcut to .bind('load', handler) and .load which is part of an Ajax module. Which one is fired depends on the arguments.
Because you are providing an URL as an argument without a selector appended to it, it will NOT strip any JavaScript contained inside the document and will execute the JavaScript block(s) prior to being passed to .html()
Make sure the JavaScript, if any, inside those PHP files is free of errors.
Upvotes: 0
Reputation: 69905
You ahve not specifed the quotes in the js. Try this
function loadtabs() {
$( ".tabs" ).tabs();
method = "<? echo $method; ?>";
mode = "<? echo $mode; ?>";
$("#oven").load('oven.php');
$("#detectors").load('detectors.php');
$("#inlets").load('inlets.php');
}
Upvotes: 1