Good evening all!
i have an Ajax call that loads 5 ‘echo’s’ from a php script into a div.
The first echo creates a hidden form field with an ID as the value.
the rest are superficial and have links to move the div around the page.
In firefox, the full data is loaded, but in IE, it misses out the first echo, to just display the other details. Im missing the hidden element i need as an identifier.
//Some other PHP code..... the * and % in the value are delimiters for splitting a string later.
echo "<input type='hidden' value='*$substept,$subscon%'>";
echo "<a href='javascript:remcol($part)'>.-.</a>".$substept . "<a href='javascript:paddcolumn($part)'>.+.</a> <br> <a href='javascript:mleft($part)'><<</a>" . $subscon . "<a href='javascript:mright($part)'>>></a>";
echo "<br>Column title <br><input type='text' id='title' size = '10'>";
echo "<br>Column width ";
echo "<br><input type='text' id='tb' size = '10'>";
How on earth can IE selectively miss out a line of php?! There is absolutely no html for a hidden field.
Yet.
This doesn’t happen every time. this function is called up to 25 times for 25 different DIVs, and it will work hit an miss in IE.
Checked its inside a form etc.. no idea what’s going on!
Example source following 3 calls of this in IE 8:: Check out the Div 03 HTML.
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o1>productspgroup<INPUT value=*products,pgroup% type=hidden><A href="javascript:remcol(1)">.-.</A>products<A href="javascript:paddcolumn(1)">.+.</A> <BR><A href="javascript:mleft(1)"><<</A>pgroup<A href="javascript:mright(1)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o2>customerphone1<INPUT value=*customer,phone1% type=hidden><A href="javascript:remcol(2)">.-.</A>customer<A href="javascript:paddcolumn(2)">.+.</A> <BR><A href="javascript:mleft(2)"><<</A>phone1<A href="javascript:mright(2)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o3><A href="javascript:remcol(3)">.-.</A>products<A href="javascript:paddcolumn(3)">.+.</A> <BR><A href="javascript:mleft(3)"><<</A>price<A href="javascript:mright(3)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV id=o4></DIV>
<DIV id=o5></DIV>
<DIV id=o6></DIV>
After checking syntax as advised::
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o1><A href="javascript:remcol(1)">.-.</A> customer <A href="javascript:paddcolumn(1)">.+.</A> <BR><A href="javascript:mleft(1)"><<</A>surname<A href="javascript:mright(1)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o2><INPUT value=*customer,email% type=hidden><A href="javascript:remcol(2)">.-.</A>customer<A href="javascript:paddcolumn(2)">.+.</A> <BR><A href="javascript:mleft(2)"><<</A>email<A href="javascript:mright(2)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o3><INPUT value=*customer,email% type=hidden><A href="javascript:remcol(3)">.-.</A>customer<A href="javascript:paddcolumn(3)">.+.</A> <BR><A href="javascript:mleft(3)"><<</A>email<A href="javascript:mright(3)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV style="BORDER-BOTTOM: #000 1px solid; BORDER-LEFT: #000 1px solid; BORDER-TOP: #000 1px solid; BORDER-RIGHT: #000 1px solid" id=o4><INPUT value=*customer,email% type=hidden><A href="javascript:remcol(4)">.-.</A>customer<A href="javascript:paddcolumn(4)">.+.</A> <BR><A href="javascript:mleft(4)"><<</A>email<A href="javascript:mright(4)">>></A><BR>Column title <BR><INPUT id=title size=10><BR>Column width <BR><INPUT id=tb size=10></DIV>
<DIV id=o5></DIV>
Javascript:
function choosedata(cin){
cot = "so"+cin;
var strr="main.php?func=21&part=" + cin + "&step=" + counter[cin] + "&subs=";
colchange = 'o' + cin;
if (counter[cin] >=2){
strr = strr + document.getElementById(cot).value;
}
callajaxd(strr, colchange);
counter[cin]++;
}
function callajaxd(str,elemin) //URL String, Box to go in
{
if (str=="")
{
document.getElementById(elemin).innerHTML="";
var back = "";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
document.getElementById(elemin).innerHTML="<img src='loading.gif' />";
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(elemin).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET",str,true);
xmlhttp.send();
}
Come home now and using IE9 and it works fine, at least its only IE8 that its happening on, but i cant install IE8 on a windows 7 pc even in compatibility mode, so short of getting virtualbox out i’ll have to continue debugging tomorrow.
Thanks for all your help and advice on this.
The issue it seems, led with the cPanel hosting account i have. The server was having issues under load.
My own fault for going for shared hosting!
Cheers!