We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23624
    • 11 Posts
    I installed modx 1.0.4 but ajaxsearch1.9.0 doesn’t work.

    My call is:
    [!AjaxSearch? &ajaxSearch=`1` &landingPage=`8` &moreResultsPage=`8` &addJscript=`0` &showIntro=`0` &ajaxMax=`5` &extract=`1`!]

    If the search doesn’t find anything it display the correct message "No result found", but if it finds some result my browser gives me "Syntax error in ajaxserch.js - line:25 char:32" and no message is shown.

    I tested it with IE8, firefox, safari and the behaviour is the same.
    It works perfectly with ajaxSearch1.8.5 with the same call.

    Thank you in advance
    Luke
      • 5811
      • 1,717 Posts
      Using &addJscript=`0` imply that you include the mootool library first manualy. Is it correct ? Could you confirm that the mootool 1.11 library is correctly included
        • 23624
        • 11 Posts
        Yes, in the header I have:

        <script src="manager/media/script/mootools/mootools.js" type="text/javascript"></script>
        and mootools.js is 1.12 version (default in modx 1.04).
          • 5811
          • 1,717 Posts
          Could you check if you have a php or a mysql error ?
          If not, Could you unpack your js file by using http://jsbeautifier.org/ and let me know which is the js error
            • 23624
            • 11 Posts
            function doSearchResp(text, as) {
            var out = eval(’(’ + text + ’)’);
            ....
            ....
            }

            Syntax error is in "var" -> point on the first letter "v".

            Very strange
              • 5811
              • 1,717 Posts
              I run locally this test without problems:
              [!AjaxSearch? &ajaxSearch=`1` &landingPage=`[[GetFirstChild]]` &moreResultsPage=`[[GetFirstChild]]` &showIntro=`0` &ajaxMax=`5` &extract=`1`!]


              The landing page is here the child page.
              Have you some other js scripts called ?
                • 23624
                • 11 Posts
                Your test doesn’t work on my site (it has the same problem).
                I have another javascript:
                <script src="assets/templates/modxhost/drop_down_menu.js" type="text/javascript"></script>

                Also testing in the default installation of modx 1.0.4 doesn’t work and it gives the same error.
                Version 1.8.5 without any changes works perfectly.

                I tried also the examples in www.modx2.wangba.fr but they doesn’t work on my server, they works perfectly on www.modx2.wangba.fr.

                I think there is a problem on my server configuration, but I can’t find it.
                  • 23624
                  • 11 Posts
                  [1-Jul-10 12:24:33]  0.0070s  1.31Mb > AjaxSearch 1.9.0 - Php5.1.6 - MySql 5.0.22-log
                  [1-Jul-10 12:24:34]  0.0234s  2.18Mb > displayConfig - Config before parameter checking : Array
                  (
                      [version] => 1.9.0
                      [config] => 
                      [debug] => 1
                      [timeLimit] => 60
                      [language] => italian
                      [asId] => 
                      [ajaxSearch] => 1
                      [advSearch] => oneword
                      [whereSearch] => content|tv
                      [sites] => 
                      [subSearch] => 
                      [category] => 
                      [display] => unmixed
                      [tags] => 
                      [init] => none
                      [withTvs] => 
                      [tvPhx] => 
                      [order] => publishedon,pagetitle
                      [rank] => 
                      [maxWords] => 5
                      [minChars] => 3
                      [showInputForm] => 1
                      [showIntro] => 0
                      [resultsPage] => 0
                      [grabMax] => 6
                      [extract] => 1
                      [extractLength] => 200
                      [extractEllips] => ...
                      [extractSeparator] => <br />
                      [formatDate] => d/m/y : H:i:s
                      [highlightResult] => 1
                      [pagingType] => 1
                      [showPagingAlways] => 0
                      [pageLinkSeparator] =>  | 
                      [landingPage] => 8
                      [showResults] => 1
                      [parents] => 
                      [documents] => 
                      [depth] => 10
                      [hideMenu] => 2
                      [hideLink] => 0
                      [filter] => 
                      [output] => 0
                      [tplInput] => @FILE:assets/snippets/ajaxSearch/templates/input.tpl.html
                      [tplResults] => @FILE:assets/snippets/ajaxSearch/templates/results.tpl.html
                      [tplGrpResult] => @FILE:assets/snippets/ajaxSearch/templates/grpResult.tpl.html
                      [tplResult] => @FILE:assets/snippets/ajaxSearch/templates/result.tpl.html
                      [tplPaging0] => @FILE:assets/snippets/ajaxSearch/templates/paging0.tpl.html
                      [tplPaging1] => @FILE:assets/snippets/ajaxSearch/templates/paging1.tpl.html
                      [tplComment] => @FILE:assets/snippets/ajaxSearch/templates/comment.tpl.html
                      [stripInput] => defaultStripInput
                      [stripOutput] => defaultStripOutput
                      [searchWordList] => 
                      [breadcrumbs] => 
                      [clearDefault] => 0
                      [jsClearDefault] => assets/snippets/ajaxSearch/js/clearDefault/clearDefault.js
                      [mbstring] => 1
                      [asLog] => 0:0:200
                      [liveSearch] => 0
                      [ajaxMax] => 5
                      [showMoreResults] => 0
                      [moreResultsPage] => 8
                      [opacity] => 1
                      [tplAjaxResults] => @FILE:assets/snippets/ajaxSearch/templates/ajaxResults.tpl.html
                      [tplAjaxGrpResult] => @FILE:assets/snippets/ajaxSearch/templates/ajaxGrpResult.tpl.html
                      [tplAjaxResult] => @FILE:assets/snippets/ajaxSearch/templates/ajaxResult.tpl.html
                      [tplPaging2] => @FILE:assets/snippets/ajaxSearch/templates/paging2.tpl.html
                      [jscript] => mootools
                      [addJscript] => 0
                      [jsMooTools] => manager/media/script/mootools/mootools.js
                      [jsMooTools2] => assets/snippets/ajaxSearch/js/mootools2/mootools-1.2.4.js
                      [jsJquery] => assets/snippets/ajaxSearch/js/jQuery/jquery-1.4.2.min.js
                  )
                  
                  [1-Jul-10 12:24:34]  0.0237s  2.18Mb > getSearchString - searchString : default
                  [1-Jul-10 12:24:34]  0.0238s  2.18Mb > getSearchString - advSearch : oneword
                  [1-Jul-10 12:24:34]  0.0239s  2.18Mb > getEvents - subsearch : 
                  [1-Jul-10 12:24:34]  0.0240s  2.18Mb > getEvents - asf : 
                  [1-Jul-10 12:24:34]  0.0241s  2.18Mb > getEvents - offset : 0,0
                  [1-Jul-10 12:24:34]  0.0241s  2.18Mb > getEvents - pgn : 
                  [1-Jul-10 12:24:34]  0.0242s  2.18Mb > checkSearchString - searchString : default
                  [1-Jul-10 12:24:34]  0.0243s  2.18Mb > checkSearchString - searchSubmitted : 1
                  [1-Jul-10 12:24:34]  0.0244s  2.18Mb > checkSearchString - asfSubmitted : 
                  [1-Jul-10 12:24:34]  0.0244s  2.18Mb > checkSearchString - checkString : 1
                  [1-Jul-10 12:24:34]  0.0245s  2.18Mb > checkSearchString - searchString used : default
                  [1-Jul-10 12:24:34]  0.0272s  2.30Mb > displayInputForm - searchString : default
                  [1-Jul-10 12:24:34]  0.0273s  2.30Mb > displayInputForm - searchString : default
                  [1-Jul-10 12:24:34]  0.0353s  2.50Mb > pgCharset : UTF-8
                  [1-Jul-10 12:24:34]  0.0362s  2.51Mb > Select :  
                  SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, sc.menutitle, sc.content, sc.publishedon, 
                  GROUP_CONCAT( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, 
                  GROUP_CONCAT( DISTINCT ntv.value SEPARATOR "," ) AS tv_value 
                  FROM `modx_site_content` sc 
                  LEFT JOIN( 
                  SELECT DISTINCT tv.id, tv.value, tv.contentid 
                  FROM `modx_site_tmplvar_contentvalues` tv ) AS ntv ON sc.id = ntv.contentid 
                  WHERE ((sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.privateweb=0)) 
                  GROUP BY sc.id 
                  HAVING (((sc.pagetitle LIKE '%default%') OR (sc.longtitle LIKE '%default%') OR (sc.description LIKE '%default%') OR (sc.alias LIKE '%default%') OR (sc.introtext LIKE '%default%') OR (sc.menutitle LIKE '%default%') OR (sc.content LIKE '%default%') OR (tv_value LIKE '%default%'))) 
                  ORDER BY sc.publishedon,sc.pagetitle
                  [1-Jul-10 12:24:34]  0.0364s  2.51Mb > End of select


                  This is my debug of a search that generated the error
                    • 5811
                    • 1,717 Posts

                    I think you get a php error in the php script called by the js script (the answer with the results)

                    I saw that you use Php 5.1.6. So read this post, download the fix and try it again.
                      • 23624
                      • 11 Posts
                      Thanks a lot!

                      Now it works.

                      Luke