开发者

Code Igniter - Anchor Reutrn False?

开发者 https://www.devze.com 2023-01-18 03:30 出处:网络
I\'m trying to return false with using the anchor function in CI, as it\'s sending me to another page, rather than loading ajax.

I'm trying to return false with using the anchor function in CI, as it's sending me to another page, rather than loading ajax.

Here's my code:

<li id="addclient"><?php echo anchor('site_add_client', 'Cli开发者_开发问答ents', array('onclick'=> "content_ajax_client()")); ?>  </li>

Thanks


Just add return false in with the onclick...

<?php echo anchor('site_add_client', 'Clients', array('onclick'=> "content_ajax_client(); return false")); ?>  </li>

Et voila...


Alternatively to Robimp's answer, you could return false inside your js function.

function content_ajax_client(){
    //your code here
    return false;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消