Welcome Guest, Not a member yet? Register   Sign In
Calling function using anchor and xajax
#1

[eluser]pawan123[/eluser]
Hi ,

I want to call function using anchor

currently we have anchor("methodName", "Click here")

Here "methodName" is assigned to href bydefault. Instead of this I want to assign it to the onclick event.

I donot want to use "<a href="#">Click here</a>"
Please inspect "Click here" to get what I do not wish to Use.(Selected in blue back-color.)

Just by using anchor is it possible?

Thanks in advance.
#2

[eluser]crwtrue[/eluser]
If i understanded correctly you could try somethink like this:

$js = 'onClick="xajax_method_name(); return true;"';

echo anchor('controller/index','Click here',$js);
#3

[eluser]pawan123[/eluser]
Thanks for your fast reply,

this is working. I have one more query. Instead calling URL 'Controller/index' I want to put # or javascrpt:void(0);

Thank you ..
#4

[eluser]crwtrue[/eluser]
im not sure. you have probably tryed this allready:

$url = 'javascrpt:void(0);';

echo anchor($url,‘Click here’,$js);
#5

[eluser]pawan123[/eluser]
thanks for the reply.

It takes the site url bydefault and appends the "first segment" to it.

I have made changes in CI helper file to get the result.




Theme © iAndrew 2016 - Forum software by © MyBB