AjaxFw (CJAX) For CodeIgnater 5.0 Stable |
[eluser]Ajaxboy[/eluser]
This is very simple, and there are different ways it could be accomplished. #1. You could add on "change" event to the textbox where the promo code is entered: Code: $ajax->Exec('text_id', $ajax->call('ajax.php?PromoCode/checkPromoCode/|text_id|'),'change'); Code: class PromoCode extends CI_Controller { You could have a button (or an image) some where to apply the code. Code: $ajax->Exec('button_id', $ajax->call('ajax.php?PromoCode/checkPromoCode/|text_id|')); (apply same controller sample as above) Let me know if these examples are not clear enough or if you need further explanation :) Once the promo code is applied, you can manipulate elements on the front to reflect the changes, see this: http://cjax.sourceforge.net/docs/manipul...tainer.php You could update the total price by grabbing shopping cart total minus promo code value, and update the total: Code: $ajax->total = "New Total"; documentation: http://cjax.sourceforge.net/docs/ ajaxboy
[eluser]Ajaxboy[/eluser]
New version available: http://ellislab.com/forums/viewthread/224403/ be sure to leave a review and vote!.
[eluser]Unknown[/eluser]
Hi I got some errors PHP: 5.x Codeigniter: 2.x Sparks: installed Code: Strict Standards: Declaration of CJAX_FRAMEWORK::dialog() should be compatible with that of cjaxFormat::dialog() in /Users/easter1021/proj/development/cjax/core/classes/cjax.class.php on line 26 Solutions: 1. modify php.ini Code: error_reporting = E_ALL ^ E_STRICT Code: error_reporting(E_ALL ^ E_STRICT); I was done your solutions, but same problem. I need your help, thanks.
[eluser]Ajaxboy[/eluser]
1. Make sure you have restarted your server. 2. If the above doesn't work, and if strict standard can't be turned off there is a problem with your PHP installation.
[eluser]salvomil[/eluser]
Hi boys. This library is very very good and so I use it in my project. I have a question. I have to autocomplete a search field, and I use the keyup event for this $ajax->keyup("name", $ajax->call("ajax.php?mycontroller/get_names/|name|")); I'd like to fire the binding only on a min length of search field (for example if the length of search field is 3 then I call the get_names function). How can I set this condition? Thank you.
[eluser]Ajaxboy[/eluser]
Hello salvomil, That can be accomplished with a wrapper around the call() function, which can be done with a plugin. Here is A generic sample, which is untested, but if you have problems and would like more help let me know. First create file cjax/plugins/call2/call2.js, then add the following code in it: Code: //cjax/plugins/call2/call2.js The code is pretty self explanatory. //using call2 plugin Code: $ajax->keyup("name", $ajax->call2("ajax.php?mycontroller/get_names/","name"));
[eluser]salvomil[/eluser]
Thank you Ajaxboy, this is what I need. I undestand now how to use plugins. But when I try the steps you suggested me I get the following warnings: A PHP Error was encountered Severity: Warning Message: Illegal offset type Filename: classes/cjax.class.php Line Number: 194 A PHP Error was encountered Severity: Warning Message: Illegal offset type Filename: classes/cjax.class.php Line Number: 197 and the ajax call does not fire. I tried also the following version $ajax->keyup("name", $ajax->call2("ajax.php?mycontroller/get_names/|name|")); but nothing happens....
[eluser]Ajaxboy[/eluser]
I see. Yeah I guess Exec events don't currently bind plugins as parameters. I'll add this to the todo list. For the time being you will need to do the length check on the back end within the ajax request.
[eluser]salvomil[/eluser]
Yes, and it is what I do function search_names($search, $field) { if (strlen($search)>2) { $ajax = ajax(); $out = array(); $c = new Comune(); $where = "ist_descrizione like '$search%'"; $c->where($where)->get(); .......etc But you can image that every time I press a key there is always an ajax call and a little waste of time.... Another good thing woul be to let a timeout for a keyup event (every 0.3 ms for example) to avoid to have many ajax calls. However thank you for your job!
[eluser]Ajaxboy[/eluser]
Sure. Thanks for your inquiry and be sure to rate Cjax if you like it: http://sourceforge.net/projects/cjax/reviews/ (and leave a brief review). When the changes requested are released they will be posted here. Please be aware that this thread is for the older version, for the newer version (5.1) be sure to post here: http://ellislab.com/forums/viewthread/224403/ |
Welcome Guest, Not a member yet? Register Sign In |