Hello,
as I am working on some improvements on the karma plugin, I am wondering which event hook best to be used for ajax calls. At the moment I am referencing to the external-plugin event hook in order to be sure that no unwished content/header ist send with the answer. Would it also be possible to reference to the frontend_configure event hook? Are there any advantages/disadvantages using the one or the other?
Regards
Greg
Which event hook for ajax calls?
Re: Which event hook for ajax calls?
Hi
Which url would you use for that? And how to fill the event-data-array properly? external-plugin is the normal way and fitting.
Which url would you use for that? And how to fill the event-data-array properly? external-plugin is the normal way and fitting.
Re: Which event hook for ajax calls?
Hi,
and thanks for your response. The url I used is "plugin/karma-ajaxquery". The eventData-Array doesnt need to be filled, because the votes are stored in the database immediately and the servers answer is handled with methdos of the DOM. The problem of using the external-plugin-event is that i have to copy the code of the frontend_configure-event or to put it in an extra function.
Regards
Greg
and thanks for your response. The url I used is "plugin/karma-ajaxquery". The eventData-Array doesnt need to be filled, because the votes are stored in the database immediately and the servers answer is handled with methdos of the DOM. The problem of using the external-plugin-event is that i have to copy the code of the frontend_configure-event or to put it in an extra function.
Regards
Greg
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Which event hook for ajax calls?
Hi!
frontend_configure is also executed before external_plugin is loaded. So you could do your checks there and abort the s9y execution workflow.
"external_plugin" however is better fitting in terms of letting others understand that an external URL is involved, it's simply "cleaner".
I would suggest to capsulate the code in a class method, and call $this->ajax() in the event hook, then you can avoid redundant code...?
Regards,
Garvin
frontend_configure is also executed before external_plugin is loaded. So you could do your checks there and abort the s9y execution workflow.
"external_plugin" however is better fitting in terms of letting others understand that an external URL is involved, it's simply "cleaner".
I would suggest to capsulate the code in a class method, and call $this->ajax() in the event hook, then you can avoid redundant code...?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Which event hook for ajax calls?
Hi Garvin,
thx for your advice. I will give it a try.
Greg
thx for your advice. I will give it a try.
Greg
Re: Which event hook for ajax calls?
Well then,
it took some time but now I think it's done. You can download the ajax improved karma plugin at http://www.studium-auskunft.de/uploads/ ... _karma.zip. Hope it will be of worth! English and german language files are updated as well.
Regards,
Greg
EDIT: Now, I also fixed some minor bugs.
it took some time but now I think it's done. You can download the ajax improved karma plugin at http://www.studium-auskunft.de/uploads/ ... _karma.zip. Hope it will be of worth! English and german language files are updated as well.
Regards,
Greg
EDIT: Now, I also fixed some minor bugs.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Which event hook for ajax calls?
Hi!
Great work! Looks very solid, I just committed it to git! You might want to announce this on a seperate thread so people can test it?
Regards,
Garvin
Great work! Looks very solid, I just committed it to git! You might want to announce this on a seperate thread so people can test it?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Which event hook for ajax calls?
Thanx for your appreciation. I'll promote it on a a new thread.
Greg
Greg