Support » Plugin: Ajaxize » [Plugin: Ajaxize] call function onClick

  • Resolved 2046



    can you help me to find a way how to call function through Ajaxize on object Click.
    As I understood, default the ajax call is made on the page load. But how can we call it on mouse click?
    I have tried to “hack” the refresh example from the FAQ but with no luck.

    thanks in advance 2046

Viewing 6 replies - 1 through 6 (of 6 total)
  • 2046


    simple hack is
    go to ajaxize_this.js and hack it this way

    [Code moderated as per the Forum Rules. Please use the pastebin]

    that does the trick. What is the trick?
    The trick is that the ajax call is done only when somebody clicks on the html object with given CSS id 🙂

    sweet 😉

    Plugin Author yoav.aner


    Hi 2046,

    Glad to see some enhancements, but your code was removed by the moderators. Can you please post it on pastebin as advised so other people can also benefit from it??



    hope the code will reach the other end of line.
    here is the link to the changed code

    btw, be aware that the internal plugin test function stop working(because the code does not run onLoad)
    And that you have no flexibility for different div elements then the one you define in the changed code, plus if you update the plugin, all changes are lost indeed.

    Plugin Author yoav.aner


    Thanks for sharing the code 2046.

    Would be nice if you can give positive feedback about ajaxize if you like it!


    I’m trying to get my sidebar.php ajaxed so that everytime I click on link on sidebar.php the class in page.php will gets refreshed and not the sidebar.php.

    I tried the hack but is not working. Could you please show me how to get sidebar.php ajaxed? Thanks

    this is my code for sidebar.php

    <h2>Related Videos</h2>
    					<div id="scroll-pane">	<div id="scroll-content">
    $IDOutsideLoop = $post->ID;
    while( have_posts() ) {
    	foreach( ( get_the_category() ) as $category )
    		$my_query = new WP_Query('category_name=' . $category->category_nicename . '&orderby=date&order=desc&showposts=100');
    	if( $my_query ) {
    		while ( $my_query->have_posts() ) {
    			$my_query->the_post(); ?>
    <div class="scroll-content-item">
    							<div class="singleright">
    				<div class="single_img_block_img"><div class="side_img_block"><a href="<?php the_permalink() ?>"  rel="bookmark" title="<?php the_title_attribute(); ?>"><?php $vthumb = get_post_meta($post->ID, 'video_thumb', true);  echo '<img src="'.$vthumb.'/default.jpg" width=96px height=72px/>';?></div></a></div>
    				<div class="singlerighti">
    					<div class="singlerightinfo">
    						<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?></a>
    					<div class="postviews">
    						<?php if(!function_exists('easy_relative_date')){the_time('F jS, Y'); } else { echo easy_relative_date(get_the_time('U')); } ?>
    					<div class="postviews">
    						<?php if(function_exists('the_views')) { the_views(); } ?>

    this is my single.php

    <div class="singlebody">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<div class="singlepost">
    				<h2><?php the_title(); ?></h2>
    					<?php the_content(); ?>
    <div class="pagenumbers"><?php wp_link_pages(array('before' => '<div class="font_normal">一共有: </div>','after' => '', 'next_or_number' => 'number'));  ?><?php wp_link_pages(array('before' => '', 'next_or_number'=>'next', 'previouspagelink' => ' &laquo; Go Back  ',  'nextpagelink'=>'  Watch 下一個片段 &raquo; ')); ?>
    		<div class="postinformation">
    						<div class="single_postviews">
    						<?php if(function_exists('the_views')) { the_views(); } ?>
    					<p><font style="font-weight:bold;">Post Date:&nbsp;</font> <?php if(!function_exists('easy_relative_date')){the_time('F jS, Y'); } else { echo easy_relative_date(get_the_time('U')); } ?><br>
    						<font style="font-weight:bold;">Category:&nbsp;</font> <?php the_category(', ') ?><br>
    						<?php the_tags( '<font style="font-weight:bold;">Tags:</font> ', ', ', ''); ?></p>
    					<?php include (TEMPLATEPATH . '/sidebar_single.php'); ?>

    Ajaxize Ajaxizes functions.
    If I understand right you click on the link only(in sidebar) and do not call “any” function.

    If you want to call the post content via ajax(Ajaxized) then the link has to call a function which will be hooked to Ajaxized..
    so you have to make a function that holds the loop and from sidebar call that function.

    little bit step by step coding might be better solution..depends

    I’m sure you thought about it already, but I found out Ajax post loading non-user friendly… when they hit back they do not understand why they do not see what they saw :).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Ajaxize] call function onClick’ is closed to new replies.