Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem with jquery tabs and ajax , behaviour change is observed between tabs eventhough they have similar html
    primarykey
    data
    text
    <p>I am working on creating a html page with three tabs, each one of which pulls data from three different html pages through jquery ajax. I am passing 2 parameters , method and mode ( to set read only or edit for all the html elements in the page ) while calling the ajax function.</p> <p>The problem I have is, when i set the parameters with method=somemethod&amp;mode=ro, the first renders the proper method and in readonly mode, whereas the second tab's html is rendered in edit mode. I debugged the page using firebug but couldnot find the actual problem. All the three tab htmls are all the similar, so i have no idea why this is happening. I have attached the code. Kindly help. </p> <p>Main html/php page.</p> <pre><code>&lt;? $method = $_GET['method']; $mode = $_GET['mode']; ?&gt; &lt;html&gt; &lt;head&gt; &lt;link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /&gt; &lt;link type="text/css" href="./methodeditor.css" rel="stylesheet" /&gt; &lt;script type="text/javascript" src="../../js/jquery-1.5.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"&gt;&lt;/script&gt; &lt;script&gt; function loadtabs() { $( ".tabs" ).tabs({cache:false}); //$( ".tabs" ).tabs(); method = "&lt;? echo $method; ?&gt;"; mode = "&lt;? echo $mode; ?&gt;"; $.ajax({ type: "GET", url: "oven.php", data: "method=" +method+"&amp;mode="+mode, cache: false, async: true, success: function(data){ htdata = data; $("#oven").html(data); }, }); $.ajax({ type: "GET", url: "detectors.php", data: "method=" +method+"&amp;mode="+mode, async: true, cache: false, success: function(data1){ htdata = data1; $("#detectors").html(data1); }, }); $.ajax({ type: "GET", url: "inlets.php", data: "method=" +method+"&amp;mode="+mode, async: true, cache: false, success: function(data){ $("#inlets").html(data); }, }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="editor" action="method.php" method="POST" &gt; &lt;div class="editor"&gt; &lt;div class="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#oven"&gt;Oven&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#detectors"&gt;Detectors&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#inlets"&gt;Inlets&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="oven" &gt;&lt;/div&gt; &lt;div id="detectors" &gt;&lt;/div&gt; &lt;div id="inlets"&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; loadtabs(); &lt;/script&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>tab1 php</p> <pre><code>&lt;? $method = $_GET['method']; $mode = $_GET['mode']; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Oven&lt;/title&gt; &lt;link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /&gt; &lt;script type="text/javascript" src="../../js/jquery-1.5.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"&gt;&lt;/script&gt; &lt;script&gt; function togglestatus(val) { if ( val == "ro" ) { $('#elements :input').attr('disabled', true ); } if ( val == "edit") { $('#elements :input').removeAttr('disabled'); } } function getvalues() { //file = window.method; file = "&lt;? echo $method; ?&gt;"; file = "./method/"+file; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", file, false); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(""); xmldoc = xmlhttp.responseXML; etimenode = xmldoc.getElementsByTagName("method")[0].childNodes[1].childNodes[1]; etime = etimenode.textContent; document.getElementById("etime").value = etime; maxovtp = xmldoc.getElementsByTagName("method")[0].childNodes[1].childNodes[5].childNodes[0].data; document.getElementById("maxovtp").value = maxovtp; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="elements"&gt; &lt;input type="checkbox" id="oventemp" value="ON" /&gt;Oven Temperature&lt;br /&gt; Equilibrium time &lt;input type="text" id="etime" /&gt;&lt;br /&gt; Maximum Oven Temperature &lt;input type="text" id="maxovtp" /&gt;&lt;br /&gt; &lt;script&gt; getvalues(); x = "&lt;? echo $mode; ?&gt;"; togglestatus(x); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>tab2 php/html page</p> <pre><code>&lt;? $method = $_GET['method']; $mode = $_GET['mode']; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Detectors&lt;/title&gt; &lt;link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /&gt; &lt;script type="text/javascript" src="../../js/jquery-1.5.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"&gt;&lt;/script&gt; &lt;script&gt; function togglestatus(val) { if ( val == "ro" ) { $('#elements :input').attr('disabled', true ); } if ( val == "edit") { $('#elements :input').removeAttr('disabled'); } } function getvalues() { file = "&lt;? echo $method; ?&gt;"; file = "./method/"+file; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", file, false); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(""); xmldoc = xmlhttp.responseXML; heater = xmldoc.getElementsByTagName("method")[0].childNodes[3].childNodes[1].childNodes[1].childNodes[0].data; document.getElementById("heater").value = heater; h2flow = xmldoc.getElementsByTagName("method")[0].childNodes[3].childNodes[1].childNodes[3].childNodes[0].data; document.getElementById("h2flow").value = h2flow; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="elements"&gt; Heater Status &lt;input type="checkbox" id="heaterstat" value="ON" /&gt;&lt;br /&gt; Heater &lt;input type="text" id="heater" /&gt;&lt;br /&gt; H2 Flow &lt;input type="text" id="h2flow" /&gt;&lt;br /&gt; &lt;script&gt; getvalues(); x = "&lt;? echo $mode; ?&gt;"; togglestatus(x); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload