Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Function not defined, when it really is?
Old 01-23-2009, 12:55 PM Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
Script: Firebug says "replaceshow" is not defined, when it is.. I don't see any syntax errors?
Code:
<script type="text/javascript" src="prototype.js"></script>
<script>
function replaceshow(show_id,dog_id) {

        new Ajax.Request("ajaxentershow.php",
                    {
                    method: 'post',
                    postBody: 'show_id='+show_id+'&dog_id='+dog_id,
                    onComplete: showResponse
                    });
                }

            function showResponse(req){
                $F('foo'+show_id).innerHTML= req.responseText;
            }

</script>

<?php
print "<b><a href='#' onClick='replaceshow($row[show_id],$dog_id)' id='foo$row[show_id]'>enter this show</a></b><br>";
?>

Last edited by kernelgpf; 01-23-2009 at 01:00 PM..
kernelgpf is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-23-2009, 01:11 PM Re: Function not defined, when it really is?
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
print "<b><a href='#' onClick='replaceshow($row[show_id],$dog_id)' id='foo$row[show_id]'>enter this show</a></b><br>";

should probably be

print "<b><a href='#' onClick='replaceshow({$row['show_id']},$dog_id)' id='foo{$row['show_id'}]'>enter this show</a></b><br>";

I don't see anything else that could be wrong.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-23-2009, 03:19 PM Re: Function not defined, when it really is?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
add the type attribute to the script tag as well.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-23-2009, 04:25 PM Re: Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
Did both, neither fixed the problem.
kernelgpf is offline
Reply With Quote
View Public Profile
 
Old 01-23-2009, 04:27 PM Re: Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
The variables are fine, they show up in Firebug's HTML code, it's just the Javascript somewhere.
kernelgpf is offline
Reply With Quote
View Public Profile
 
Old 01-23-2009, 04:33 PM Re: Function not defined, when it really is?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Link ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-23-2009, 04:40 PM Re: Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
http://straydays.co.uk/shows.php?
kernelgpf is offline
Reply With Quote
View Public Profile
 
Old 01-23-2009, 05:15 PM Re: Function not defined, when it really is?
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
How about you put in a doctype, and a html, head and body tag?
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>

Last edited by Insensus; 01-23-2009 at 05:16 PM..
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-23-2009, 05:47 PM Re: Function not defined, when it really is?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
works for me, developer bar shows no script errors.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2009, 01:02 AM Re: Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
Wait, so the "enter this show" is removed and "successfully entered" replaces it? That is my goal, and it is not doing that for me.
kernelgpf is offline
Reply With Quote
View Public Profile
 
Old 01-24-2009, 01:18 AM Re: Function not defined, when it really is?
Novice Talker

Posts: 7
Name: Alyssa
Trades: 0
Got it working! I combined my Javascript codes, added head/doctype/body, and it is accessing the function now.
kernelgpf is offline
Reply With Quote
View Public Profile
 
Old 01-24-2009, 07:32 AM Re: Function not defined, when it really is?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by kernelgpf View Post
Wait, so the "enter this show" is removed and "successfully entered" replaces it? That is my goal, and it is not doing that for me.
Well! Had you let us know that little bit of information in the first post we might not have wasted time in just looking for a syntax error.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Function not defined, when it really is?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33751 seconds with 12 queries