Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a very wierd problem, maybe very easy to fix for any of u, but im struggling with it for days now.

I have a live search in my plugin, that works fine when i directly fire the function ( $this->function() ), but returns a 0 when i put it in a shortcode.

Is there any communication that has to be changed? I've tested a alert and it reached the Ajax/jquery code.

Hope someone can help me out!

$(document).ready(function(){
$(".search").keyup(function() { 
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='')
{
    $.ajax({
    type: "POST",
    url: ajaxurl,
    data: dataString,
    cache: false,
    success: function(html)
    {
    $("#result").html(html).show();
    }
    });
} return false;    
});

jQuery("#result").live("click",function(e){ 
    var $clicked = $(e.target);
    var $name = $clicked.find('.name').html();
    var decoded = $("<div/>").html($name).text();
    $('#searchid').val(decoded);
});
jQuery(document).live("click", function(e) { 
    var $clicked = $(e.target);
    if (! $clicked.hasClass("search")){
    jQuery("#result").fadeOut(); 
    }
});
$('#searchid').click(function(){
    jQuery("#result").fadeIn();
});
});
share|improve this question

marked as duplicate by Pieter Goosen, ialocin, toscho Jul 12 at 1:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.