Coroico / AdvSearch

Dynamic content search add-on for MODx Revolution that supports results highlighting, faceted search and search in custom packages
21 stars 14 forks source link

problem #69

Closed redtoadmedia closed 10 years ago

redtoadmedia commented 10 years ago

Hi, I'm having a strange issue with the live search. It completes the search but does not display the results unless I clear the search box. I used the default script at first then replaced it with the one in your demo, same results. Type in "test"

http://ss.iuhealthlearning.com/test-search.html

you can see it here, am using Firefox and Chrome for mac. I'm guessing the keyup/down isn't firing for whatever reason but it works on your demo so am stumped.

goldsky commented 10 years ago

any hint from browser's console?

redtoadmedia commented 10 years ago

I reloaded everything and updated and now ajax just doesnt work.

I've written to you on modx forums as well. there are no errors nothing in console, I see the xhr and the results page shows in my preview pane but does not load into the results div. it looks like the command to inject the data is missing? I can't find it.

$.getJSON(as.arh,pars,function(data) {
    if (data) {
        ids = '';
        if (data.ids) ids = data.ids;
        json = '';
        if (data.json) json = data.json;
        html = '';
        if (data.html) html = data.html;

        as.ofs = parseInt(data.ofs);    // offset
        if (as.gmp && json) gmUpdateMap(as.gmp,json);

        as.rw.reswinUp(as.eff);         
        as.rw.html(html).reswinDown(as.eff);
        initPrevNext(as);
    }

I see reswinDown but where is the append?

what am I missing?

goldsky commented 10 years ago

you must use Empty (0) template for the &ajaxResultsId target. It expects JSON only respond.

redtoadmedia commented 10 years ago

Can you give me example? On Mar 20, 2014 4:13 AM, "rico" notifications@github.com wrote:

you must use Empty (0) template for the &ajaxResultsId target. It expects JSON only respond.

Reply to this email directly or view it on GitHubhttps://github.com/Coroico/AdvSearch/issues/69#issuecomment-38143183 .

redtoadmedia commented 10 years ago

I'm using the base template. So I have to use empty? What if I have output=HTML? On Mar 20, 2014 4:55 AM, "Anne Miles" anne@redtoadmedia.net wrote:

Can you give me example? On Mar 20, 2014 4:13 AM, "rico" notifications@github.com wrote:

you must use Empty (0) template for the &ajaxResultsId target. It expects JSON only respond.

Reply to this email directly or view it on GitHubhttps://github.com/Coroico/AdvSearch/issues/69#issuecomment-38143183 .

goldsky commented 10 years ago

Can you give me example?

http://www.revo.wangba.fr/livesearch-and-opacity.html

The content of the ajaxResults Handler page #76 is:

[[!AdvSearch? 
 &withAjax=`1`
 &ids=`[[!GetIds? &ids=`c38`]]` 
 &perPage=`5` 
 &opacity=`0.5` 
]]

Apply template: (empty) to the page #76.

I'm using the base template. So I have to use empty? What if I have output=HTML?

output=HTML is AdvSearch's property. It'll parse the templates anyway. But AJAX expects JSON respond (that's why it uses $.getJSON()).

Inside the JSON, there's an "html" object (from output=HTML), which will be placed onto the output dom.

as.rw.html(html).reswinDown(as.eff);
redtoadmedia commented 10 years ago

I changed it to empty and it still does not work

redtoadmedia commented 10 years ago

I got it. may have more questions soon...this needs to be added to rtfm asap

goldsky commented 10 years ago

ok, please open new thread and close this if the upcoming one is not related. :)