CodeIgniter Forums
Fatal error in relation to Javascript - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Fatal error in relation to Javascript (/showthread.php?tid=33151)

Pages: 1 2 3


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
OK... I have it dropping content into the DIV tag... but what it is dropping is is the ENTIRE page that I'm currently viewing - not the "sell_sheet_builder/contenta/?" page which amounts to a few drop downs or text area or whatever is defined based on their selection...

Any idea why?

I suspect it has to do with my links in the html of the view file

Code:
<a href="[removed]loadContenta(1);" class="build">PCMO Product</a>
<a href="[removed]loadContenta(2);" class="build">HDEO Product</a>
<a href="[removed]loadContenta(3);" class="build">Industrial Product</a>
<a href="[removed]loadContenta(4);" class="build">Aviation Product</a>
<a href="[removed]loadContenta(5);" class="build">Custom Content</a>
<a href="[removed]loadContenta(6);" class="build">Library Content</a>  
<a href="[removed]loadContenta(7);" class="build">Promotions</a>
<a href="[removed]loadContenta(8);" class="build">Kendall Locator</a>
            
<div id="regiona" style="margin-top:24px;clear:both;display:block; ">
    --
</div>



Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]Mark Croxton[/eluser]
Classic error - you need to return false from the js function to prevent your link being followed Smile


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
OK... First... I'm not intimately familiar with Javascript... although I'm learning it...

Where is it best to return false from?
I have tried a few different things... either they don't affect the page loading or nothing happens at all..

2 things I've tried (among others):

first was to change my links to an "onclick" event with return false tagged on the end...

Second was..

Code:
<a href="[removed]loadContenta(1); return false;" class="build">PCMO Product</a>

the first had no effect on the previous behaviour, the second - nothing happened at all.

Your help is really appreciated... I know this isn't a Javascript forum.

Russ


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]Mark Croxton[/eluser]
You need to use the onclick event handler not the href of your link.

href="#" onclick="myfunction();return false;"


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
I had tried that... a regular <href="#"> with:

onclick="loadContenta(1); return false;"

would that be correct?

This still returns the entire current page in my div tag for me...


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]Mark Croxton[/eluser]
yep should work


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
[quote author="Mark Croxton" date="1282167868"]yep should work[/quote]

This still returns the entire current page in my div tag for me…

I'll keep digging... thanks for the help...


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
[quote author="Mark Croxton" date="1282167868"]yep should work[/quote]

This still returns the entire current page in my div tag for me… I'll keep diggin'... thanks for the help Mark.

Russ


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]danmontgomery[/eluser]
Sure it's not being cached?


Fatal error in relation to Javascript - El Forum - 08-18-2010

[eluser]russ_kern[/eluser]
Positive... tried multiple browsers & Platforms (javescript I know can behave differently between OS's)

R