Wrox Programmer Forums
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 4th, 2009, 10:10 AM
Wrox Author
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default so......

somewhere in your main template view, you need to have something like this:

<script type="text/javascript">
base_url = '<?= base_url();?>';
that way you can use base_url in your javascript as needed.

just need to check, is that what you have?
Thomas Myer
Author, Professional CodeIgniter
Old November 4th, 2009, 05:02 PM
Authorized User
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Yes, I have it but...

Yes, I have it but it seems it does nothing.
Old January 12th, 2011, 01:03 PM
Registered User
Join Date: Jan 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

What works for me:

function jsUpdateCart()
url: "<?php echo site_url() . 'shop/ajax_cart';?>",

EDIT: i put the JS code in the template.php ..

EDIT2 : i use JQuery but with scriptaculous may seem like this, if you put the script in template.php file:

var ajax = new Ajax.Updater(
'ajax_msg', <?php echo site_url() . 'welcome/ajax_cart';?>, {method:'post',parameters:params,onComplete:showMe ssage}

trust me, 100% working this way

Last edited by Linc0ln; January 12th, 2011 at 01:13 PM..
Old November 23rd, 2011, 12:39 PM
Registered User
Join Date: Nov 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default hi , can you tell us what apatche you used please ?

Originally Posted by myerman View Post
the base_url addition is a weird one. on my dev, test, and production servers, I don't need it at all. however, this easy fix has worked for various folks I've been emailing with. I'm not really sure what's happening here, maybe it has something to do with the way the different apache installs produce paths....?
i have apatch 2.0.49 and the javascript code didnt worked till i added the base_url string , can you tell us what was your apatche version when you developed this project so we can test it without the base_url here,
thank you.
Old June 4th, 2012, 07:47 AM
Registered User
Join Date: Jun 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Cart Updated message flash and disappears

everything in it running ok javascript pases message to the shopping cart.php and message of update and deletation appears but page again gets refresh and <div id="ajax_msg"> this time appears to be blank any suggestion for stopping the update message to disappear.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shopping Cart seannie ASP.NET 2.0 Basics 0 December 12th, 2006 10:28 AM
Shopping Cart quantity update problem j2 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 August 21st, 2006 02:39 PM
Shopping Cart inkrajesh ASP.NET 1.0 and 1.1 Basics 2 February 28th, 2006 03:08 AM
shopping cart isheikh BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 October 8th, 2004 04:20 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.