Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-21-2008, 05:47 PM   PM User | #1
tyfeatherston
New to the CF scene

 
Join Date: Dec 2007
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
tyfeatherston is an unknown quantity at this point
Help with Errors

I want this script to run with out an error. It currently deletes a row from a table after if runs a php scipt.

Everything works but I get two errors.

document.getElementbyId(...).deleteRow(...) is null or not an object.

and

runtime error on line 35 // which is on the same line as the other error.

// JavaScript Document - FM_CMS Ajax

var xmlHttp

var rowloc

function getRow(loc)
{
rowloc=loc
}

function Delete(str, temploc)
{
getRow(temploc)
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="delete.php"
url=url+"?id="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
if(rowloc != null)
{
// line 35 // document.getElementById('contenttable').deleteRow(rowloc).innerHTML=xmlHttp.responseText
}
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
tyfeatherston is offline   Reply With Quote
Old 03-25-2008, 02:12 AM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
How can you delete a row and set its innerHTML? Sounds fishy to me.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:37 PM.


Advertisement
Log in to turn off these ads.