Skip to main content
Inspiring
April 21, 2017
Answered

Using a PHP AJAX Live Search within Captivate works in XAMPP, but not on LAMP server.

  • April 21, 2017
  • 2 replies
  • 390 views

Hello,

CP9 9.02.437

Win 7

IE11 / Chrome / Firefox

HTML5 only

I wanted to use a 'live search' in my Captivate project.

I found exactly what I needed on the w3schools site at PHP AJAX Live Search

(A .html file calls a .php file, that reads an .xml file, it sounds complicated, but its actually very simple and works perfectly.)

I copied the LiveSearch code from w3schools and ran the .html on my local PC using XAMPP, and it worked.

I created a single slide Captivate HTML5 project with a Web Object pointing at the LiveSearch .html, and ran in XAMPP, and it worked.

I put the Captivate project and LiveSearch code on my Linux (LAMP) server using exactly the same names and folder structure,  and it did not work. The search box is displayed, but no results are returned.

I've tried using IE11, Chrome and Firefox, but it still fails.

I know its a long shot, but does anyone have any suggestions as to why it does not work from the server?

Thank you.

Peter

    This topic has been closed for replies.
    Correct answer petern33480613

    Rod,

    I did some more digging and eventually found the answer.

    The problem was with the first line of my PHP code.

    $xmlDoc=new DOMDocument();

    By using the F12 Consule view in Chrome I could see that an error was being triggered by the DOMDocument command.

    Trawling the internet brought up this link http://php.net/manual/en/dom.setup.php, which suggested that "yum install php-xml" may be needed to install DOM/XML function.

    After that was done the server was rebooted and initial testing seems to indicate that the LiveSearch is working.

    This LiveSearch is going to be a real bonus. I have approx 100 individual training modules that are called from a main menu project. The LiveSearch will enable the user to type in search criteria and be shown an instant list of modules, then click on the item in the list to go to the module.

    Thank you, and I hope this info may be of benefit to other people... and save them 3 days of head scratching!

    Peter

    2 replies

    petern33480613AuthorCorrect answer
    Inspiring
    April 26, 2017

    Rod,

    I did some more digging and eventually found the answer.

    The problem was with the first line of my PHP code.

    $xmlDoc=new DOMDocument();

    By using the F12 Consule view in Chrome I could see that an error was being triggered by the DOMDocument command.

    Trawling the internet brought up this link http://php.net/manual/en/dom.setup.php, which suggested that "yum install php-xml" may be needed to install DOM/XML function.

    After that was done the server was rebooted and initial testing seems to indicate that the LiveSearch is working.

    This LiveSearch is going to be a real bonus. I have approx 100 individual training modules that are called from a main menu project. The LiveSearch will enable the user to type in search criteria and be shown an instant list of modules, then click on the item in the list to go to the module.

    Thank you, and I hope this info may be of benefit to other people... and save them 3 days of head scratching!

    Peter

    RodWard
    Community Expert
    Community Expert
    April 21, 2017

    This is HTML5 output from Captivate 9.  So your web server needs to have the JSON mimetype enabled.