开发者

Code Igniter - Anchor Reutrn False?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜