0

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>
3
  • Do you get any javascript errors on the page? What are the values of $method and $mode? Why aren't they wrapped in strings - "<?php echo $mode; ?>"? Commented Aug 10, 2011 at 16:02
  • Thanks... not wrapping the php code as a string was the problem... Commented Aug 10, 2011 at 16:14
  • Cool, shame someone else nicked my answer :( Commented Aug 10, 2011 at 16:17

2 Answers 2

1

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');

    }
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.