GreenDude Posted January 20, 2007 Share Posted January 20, 2007 Hi there!...I am working on a project and I was using Ajax to dinamicly alter a multidim-array.Well... everything's cool! (on Firefox)on IE6.. i get a stupid error message: "Unknown runtime error, code 0"I have no idea what's goin' on... It's my first Ajax script too, so I'll post one of the funcitons and some code: [code]function ajaxAdd( id ) { var ajaxRequest; // Browser setup try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } var tnot = document.getElementById('tnot' + id).checked; var tntt = document.getElementById('tntt' + id).checked; var tabn = document.getElementById('tabn' + id).checked; var tabm = document.getElementById('tabm' + id).checked; var tip = new Array(tnot, tntt, tabn, tabm); for ( var i =0 ; i<4; i++ ) if (tip[i]) var type = i; ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if ( type == 0 || type == 1 ) var ajaxDisplay = document.getElementById('ajaxNote' + id); else var ajaxDisplay = document.getElementById('ajaxAbs' + id); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var datz = document.getElementById('datz' + id).value; var datl = document.getElementById('datl' + id).value; var nota = document.getElementById('nota' + id).value; var queryString = "?id=" + id + "&tip=" + type + "&datz=" + datz + "&datl=" + datl + "¬a=" + nota ; ajaxRequest.open("GET", "aj_db.php" + queryString, true); ajaxRequest.send(null); }[/code]That's the function for adding to the array. It picks up a few values form some radio buttons and fields and then passes them on to this script:[code]session_start();$id = esc ( $_GET['id'] );$datz = esc ( $_GET['datz'] );$datl = esc ( $_GET['datl'] );$nota = esc ( $_GET['nota'] );$tip = esc ( $_GET['tip'] );switch ($tip) {case 0: { $array = 'a_not'; $arr = array ( $datz, $datl, $nota ); $temp = implode ('-', $arr ); if (!is_array ($_SESSION['a_not'][$id])) $_SESSION['a_not'][$id] = array(); array_push ($_SESSION['a_not'][$id], $temp); $name = 'Note'; } break;case 1: { $array = 'a_not'; $arr = array ( $datz, $datl, $nota, 1 ); $temp = implode ('-', $arr ); if (!is_array ($_SESSION['a_not'][$id])) $_SESSION['a_not'][$id] = array(); array_push ($_SESSION['a_not'][$id], $temp); $name = 'Note'; } break;case 2: { $array = 'a_abs'; $arr = array ( $datz, $datl, 'n' ); $temp = implode ('-', $arr ); if (!is_array ($_SESSION['a_abs'][$id])) $_SESSION['a_abs'][$id] = array(); array_push ($_SESSION['a_abs'][$id], $temp); $name = 'Absenţe'; } break; case 3: { $array = 'a_abs'; $arr = array ( $datz, $datl, 'M' ); $temp = implode ('-', $arr ); if (!is_array ($_SESSION['a_abs'][$id])) $_SESSION['a_abs'][$id] = array(); array_push ($_SESSION['a_abs'][$id], $temp); $name = 'Absenţe'; } break;} echo '<tr><th width="115" class="table_clase_head" align="left" colspan="4">'.$name.'</th></tr> ';$val = $_SESSION["$array"][$id]; foreach ( $val as $key => $final_val ) { $tempa = explode ('-', $final_val); if ( $tempa[3] ) $extra = "red_span"; else $extra = 'table_clase_data'; echo '<tr> '; echo '<td class="'. $extra .'" width="20"><strong>'. $tempa[2] .'</strong></td> '; echo '<td class="table_clase_data" width="50">'. $tempa[0] .'-'. roman_numbers ($tempa[1]) .'</td> '; echo '<td class="table_clase_data" width="12"><a class="img" href="#" title="edit" onclick="ajaxEdit('. $id .','. $key .','. $tip .')"></a></td> '; echo '<td class="table_clase_data" width="12"><a class="img2" href="#" title="delete" onclick="ajaxDelete('. $id .','. $key .','. $tip .')"></a></td> '; echo '</tr> '; }[/code]PLEASE give me some help/advice... I'm on a deadline and this is the only thing that's holding me back.Cheerz! Quote Link to comment https://forums.phpfreaks.com/topic/34945-urgent-please-help-ajax-on-ie6/ Share on other sites More sharing options...
ober Posted January 21, 2007 Share Posted January 21, 2007 Normally IE complains with that error if you pass back script or form tags. Quote Link to comment https://forums.phpfreaks.com/topic/34945-urgent-please-help-ajax-on-ie6/#findComment-165593 Share on other sites More sharing options...
GreenDude Posted January 22, 2007 Author Share Posted January 22, 2007 Ummm.. I'm not really sure I understand what you just said. :( The way I see it, I'm passing just table rows back.Here is the basic structure of the forms from which I extract values for use in the Ajax functions: [code]<form name = "myform1" ><table cellpadding="0" cellspacing="0" width="270" > <tr> <td align="left" id="nota0" style="text-indent:5px;" colspan="3" height="30"> <strong><u>Data:</u></strong> <input class="fields" type="text" id="datz1" value="<?php // echo $flag_arr[0]; ?>" size="1" maxlength="2" /> <strong>(Ziua-Luna)</strong> <input class="fields" type="text" id="datl1" value="<?php // echo $flag_arr[0]; ?>" size="1" maxlength="2" /> <span id="notaspan1"> <u><strong>Nota:</strong></u> <input class="fields" type="text" id="nota1" value="<?php // echo $flag_arr[0]; ?>" size="1" maxlength="2" /></span> </td> </tr> <tr> <td align="left" valign="top" width="80"> <ul class="ul2"> <li class="li2"><input class="radio" type="radio" name="tip1" id="tnot1" value="nota" onfocus="displayNota(1,1)" checked="checked" />Notă</li> <li class="li2"><input class="radio" type="radio" name="tip1" id="tntt1" value="notat" onfocus="displayNota(1,1)" />Notă Teză</li> </ul> </td> <td align="left" valign="top" width="80"> <ul class="ul2"> <li class="li2"><input class="radio" type="radio" name="tip1" id="tabn1" value="absn" onfocus="displayNota(1,0)" />Abs. N.</li> <li class="li2"><input class="radio" type="radio" name="tip1" id="tabm1" value="absm" onfocus="displayNota(1,0)" />Abs. M.</li> </ul> </td> <td width="60" align="left" valign="middle"> <input class="submit" type="button" id="butt1" onclick="ajaxAdd(1)" value="Add" /> </td> </tr></table></form>[/code]the tables themselves appear before those forms:[code]<table id="objCnt1" cellspacing="0" cellpadding="0" align="right" > <tr><td colspan="3" height="10"></td></tr> <tr> <td width="145" valign="top" align="center" > <!-- Ajax Note --> <table cellspacing="2" cellpadding="2" class="table_clase" width="130" id="ajaxNote1"> <tr><th width="115" class="table_clase_head" align="left" colspan="4">Note</th></tr> </table> </td> <td width="145" valign="top" align="center" > <!-- Ajax Absente --> <table cellspacing="2" cellpadding="2" class="table_clase" width="130" id="ajaxAbs1"> <tr><th width="115" class="table_clase_head" align="left" colspan="4">Absenţe</th></tr> </table> </td>[/code]In those 2 tables where only the <th>'s are placed, the Ajax will do it's work and print the table content.Thanks for taking your time to read this.Best Regards,GreenDude Quote Link to comment https://forums.phpfreaks.com/topic/34945-urgent-please-help-ajax-on-ie6/#findComment-166218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.