How to add more ajax function in joomsocial?



Today I work with joomsocial ofjoomla 2.5. Joomsocial is a big commercial component, but we sometime have to edit it to fit our require. I has written a new form that let users transfer point from one to one. I try to write new ajax function but it meet some errors.

Firstly, I found the instruction in file jooms.ajax.js to call a new ajax function:

01.joms.ajax.call(sFunc, sArgs, settings)
02.joms.ajax.call('controller,function', [arg1, arg2] {
03.success: function(data) {
04.// What to do when the ajax call is successful
05.},
06.error: function(data) {
07.// What to do when the ajax call is not successful
08.// e.g. timeout, 404, 500, etc.
09.},
10.
11.// For more settings to fiddle with, look up jQuery.ajax() docs.
12.});

And then I write a function

01.function showform()
02.{
03.joms.ajax.call('profile,ajaxGetForm', [echo $userid?>], function(data)
04.{
05.console.log(data.url); // output http://www.jomsocial.com
06.console.log(data.caption); // output JomSocial
07.});
08.
09.}

and add a function ajaxGetForm in profile.php of controller.

but it just displays nothing.

then, i turn on firebug, move to console, I read that error is function not found. I thought that there must be a place for define these function. Finally i found it jax.community.php, and I add this line $jaxFuncNames[] = 'profile,ajaxGetForm'; in line175.

Finally, It run well. Now I have new function ajax in joomsocial. It is so good for us to develop more for joomsocial.

Hope that this is helpful for you.



Responses

0 Respones to "How to add more ajax function in joomsocial?"

Post a Comment

 

Link Liên kết

Thông tin liên hệ

YH: huonggiangdhtn
Skype: tthuonggiang
Return to top of page Copyright © 2010 | joomla extensions jw-extension.net