bhakti_thakkar
07-17-2007, 02:08 PM
Hi all,
i have 2 php pages i.e relations.php and save_relations.php. the relation form action ="save_relations.php" where there is just the saving of the user inputs and then redirecting the user to the view. i have written a ajax-javascript in save_relations that gives me an error "null" is not an object
can some one please tell me where am i failing
<?
if ($submit=="save") {
// save code goes here
}
?>
<script language="javascript" type="text/javascript">
<!--
ajaxFunction();
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
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;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
alert(ajaxDisplay);
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML ="<img src='images/loading.gif'> <b>loading..</b>";
window.location.href="relations.php?relation_id=<?=$relation_id?>";
}
//-->
</script> <div id='ajaxDiv'> </div>
i have 2 php pages i.e relations.php and save_relations.php. the relation form action ="save_relations.php" where there is just the saving of the user inputs and then redirecting the user to the view. i have written a ajax-javascript in save_relations that gives me an error "null" is not an object
can some one please tell me where am i failing
<?
if ($submit=="save") {
// save code goes here
}
?>
<script language="javascript" type="text/javascript">
<!--
ajaxFunction();
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
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;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
alert(ajaxDisplay);
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML ="<img src='images/loading.gif'> <b>loading..</b>";
window.location.href="relations.php?relation_id=<?=$relation_id?>";
}
//-->
</script> <div id='ajaxDiv'> </div>