Ajax star rating bar |
[eluser]taewoo[/eluser]
ok.. so I 1) updated ratings_rpc.php with the one above 2) I tried Code: http://localhost/index.php/rpc.php?j=2&q=id21&t=127.0.0.1&c=10 and this is the result I got Code: unit_longid21|
[eluser]wiredesignz[/eluser]
Well that proves the ratings_rpc is working properly. So the issue is probably javascript.
[eluser]taewoo[/eluser]
Thanks Wiredesignz... Is this a JS include issue? I'm pretty lost on this one..
[eluser]wiredesignz[/eluser]
The next thing you can try is comment out the javascript in welcome_view, see if the page updates properly. Code: <!--script type="text/javascript" language="javascript" src="js/rating.js"></script-->
[eluser]wiredesignz[/eluser]
Try this welcome_view, I have added site_url() to the css and javascript sources, make sure the url_helper is loaded. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
[eluser]taewoo[/eluser]
Ah-ha! I got it.. in function sndReq rating.js, i changed this line Code: xmlhttp.open('get', 'rpc.php?j='+vote+'&q;='+id_num+'&t;='+ip_num+'&c;='+units); Code: xmlhttp.open('get', '/index.php/rpc.php?j='+vote+'&q;='+id_num+'&t;='+ip_num+'&c;='+units); And voila! Thanks for all your guidance and help wiredesignz. You're the man. If you're ever in Silicon Valley, let me know. I'll buy u beer!
[eluser]wiredesignz[/eluser]
My next idea was to add index.php to the javascript OR use .htaccess mod-rewrite and remove index.php. Glad you got it working
[eluser]taewoo[/eluser]
wiredesignz: Actually, implementing it is causing some sorta issue i can't seem to resolve. Will I need to modify anything if I have the URL as such Code: http://localhost/index.php/listing/view/100/rpc.php?j=4&q=100&t=127.0.0.1&c=5&r=1 where listing = controller, view = method, 100 = data ID Instead of AJAX kicking it, it seems like the browser is actually looking for http://localhost/index.php/listing/view/100/rpc.php PS: As you recommended I have in route.php: Code: $route['rpc.php'] = 'ratings_rpc/index'; Code: $config['enable_query_strings'] = TRUE;
[eluser]wiredesignz[/eluser]
ratings_rpc is a controller itself, you can't use it in that part of your URL. You should specify the redirect in your config as $config['nojs'] = the controller / function to call when javascript is disabled, The URL to use in your view is just http://localhost/index.php/rpc.php?... as normal. Remember the Ajax call is returned to the browser from the ratings_rpc controller, it is not part of your application as such.
[eluser]Unknown[/eluser]
Hello, Is there a way in which I can display also text/numbers on the image? Example http://www.wiredesignz.co.nz/ci_rating/, then I want to put numbers on each stars. Is that possible? |
Welcome Guest, Not a member yet? Register Sign In |