escomnet

escomnet supports this item

Supported

This author's response time can be up to 1 business day.

7 comments found.

Hi, great script. Do you know how i should formulate the following JSON file in the script? It’s autogenerated on a regular time so i can’t change alot on the JSON structure itself. I can’t get it to work. I need the id and keywords

{"page":[ {"@attributes":{"id":"1"},"keywords":"KLUTHE BENELUX BV\n\nSpecialisten in oppervlaktebehandeling"}, {"@attributes":{"id":"2"},"keywords":"Kluthe Benelux BV\nKluthe"}

Thanks!

Thanks for sharing this great example of unusual JSON! I’m going to update the script with a new example that shows how to deal with properties that have symbols in them. I’m sending you a private message with a more complete example, but to get you started:

You’re going to need to pass index to the foreach function on line 30 (should become key, index, val Then, in your search on line 33 use data[index]['@attributes'].id key.keywords

It worked! Thanks for the support

Thank you! For those reading this comment in the future, or with a similar problem parsing JSON properties with symbols, as of October 21, 2016, the script has been updated and you don’t need to make any changes in order to reference properties with symbols.

GLWS! Is it possible to search with multiple keywords?

Great! Another suggestion: when typing keyword it works, when pasting from clipboard i still need to hit a key to get results. May bey you can add option in search field handling that’s submit search after a paste. (sorry for bad English)

is there also a time out on when typing? if the list of items is very large and there is a refresh after each typed letter, searching can be very slow.

Thanks for your suggestions, I’ll add these to the next release. If you need them sooner, please let me know.

Hi, Can this item be used locally (i.e on local projects that are not uploaded to website or server)? Secondly, is it possible to add links to the search list or result (i.e thumbnails and texts) so that when a user clicks on them, it will load the link address? Thanks

I have sent you my JASON example to info@escomnet.com

Received, thanks, sent reply

Thank you so much! This script is amazing! Everything is working just fine. I have wished for something like this for so long to add to my app project. Now I finally have it. Thank you for this product and your amazing support. Rated 5 Stars!

Interesting. Have you tested it with heavy websites; 100K Posts, 1M Listings, 500K recipes, etc.

Not yet, but will try and let you know.

Hello. Will this work on a site like squarespace? They are hosting the data and the user doesn’t have the ability to query it directly? The search feature they offer is bad.

cheers, julie@sarahschwartz.com

Yes! It will work as long as you have a place to upload the data file (javascript file) and have an input field and div where you can show the results. If you need additional support getting it set up, just let me know.

Hi, I’ve information stored in my MySQL database. I’ve seen your script takes the data from the data_jsonp.json file. How can I combine these two things? Thanks

Thanks! I’ve sent you an email right now.

Hi Mauro, didn’t get your email yet, but the new version was approved, so you can download the full example there. Let me know if you need help with anything else. Thanks!

It’s strange my email didn’t arrive to you. Anyway, I’m going to install the new version and I’ll let you know. Thanks!

Hi, I’m using CodeIgniter framework and I’m having a big problem introducing this script on my website. I’m still not using the “data_jsonp.php” with the code that take the data from MySQL database because at the beginning I need to solve this issue.

Your script has been uploaded inside the following path:

/Applications/XAMPP/xamppfiles/htdocs/mydomain.com/scripts/live-search/

I don’t know if you know how CodeIgniter works. Anyway, I’ve a Controller file inside of which I write a function…inside of which I load the html files. So, my structure is:

public function search()
    {
        $data['title'] = ucfirst('search');
        //load page template
        $this->load->view('templates/head', $data);
        if (!$this->user->loggedin) {
            $this->load->view('templates/header_no_login', $data);
        } else {    
            $this->load->view('templates/header', $data);
        }
        $this->load->view('templates/sidebar');
        $this->load->view('pages/search');
        $this->load->view('templates/footer');
    }

In the footer (that is a .php file) I’ve written:

<script type="text/javascript" src="<?php echo base_url();?>scripts/live-search/js/search_light.js"></script>

The attribute of src is correct…I’ve tested it appropriately opening the direct url (I see the structure of “search_light.js” without problems).

Issue #1: To see the data contained inside the “data_jsonp.json” I’ve to modify the url in the search_light.js:

script.setAttribute("src", "http://localhost/mydomain.com/scripts/live-search/js/data_jsonp.json");

This is strange because the “data_jsonp.json” has been stored in the “js” folder together with the search_light.js (same structure of your zip package).

Issue #2: Considering the modifies I’ve explained in the issue #1, if I update the values inside the “data_jsonp.json”, I don’t see them on my webpage. It’s like there’s a cache and the browser read always the previous data. But I always refresh the browser page (Google Chrome) emptying the cache…

Anyway, I’ve checked your script alone and it works always, taking the information appropriately also when I update the “data_jsonp.json”.

Do you have any suggestion? Thanks

Just one minute ago it worked without do anything…and now it doesn’t work again. I don’t understand if there’s something wrong in the code of my template (bootstrap) that goes in conflict with your script or it’s just my browser that is slow. I’ll continue to test the issue and I’ll let you know.

Ok, final post about this issue…the problem was Google Chrome. I’ve tried FireFox and everything works perfectly.

I’ve configured also the MySQL-PHP version and it takes all the data from my database correctly. Now I’ve seen that when I digit words to filter results, it doesn’t work. FireFox says to me:

TypeError: key.category is null

This error is on line 32 of search_light.js:

if ((key.name.search(regex) != -1) || (key.desc.search(regex) != -1) || (key.category.search(regex) != -1)) {

Instead Google Chrome, for the same issue, says to me:

Uncaught TypeError: Cannot read property 'search' of null
at http://localhost/mydomain.com/scripts/live-search/js/search_light.js:32:88
at Array.forEach (native)
at useParsedData (http://localhost/mydomain.com/scripts/live-search/js/search_light.js:30:7)
at HTMLInputElement.<anonymous> (http://localhost/mydomain.com/scripts/live-search/js/search_light.js:54:2)

From the email you sent, it sounds like you resolved this problem on your own.

For others reading this in the future – these types of errors suggest that your JSON object does not match what you are searching for in the javascript file. For example, “the key.category is null” most likely means that your json object does not have a “category” attribute.

by
by
by
by
by
by