Comments (16)
@lengerfulluse I think it's because of an invalid JSON,
Simple-Jekyll-Search/src/JSONLoader.js
Line 14 in 77c80aa
Try to validate it here: http://jsonlint.com/
from simple-jekyll-search.
I got the similar error about can't found the search.json. My search json just put in the path root. Could you please help to check it?
from simple-jekyll-search.
Thanks for reporting, and sorry for the inconvenience :(
Could you please post the code how you initialize the library?
from simple-jekyll-search.
If this is related to the initialising the plugin then I might have had the same issue basekit/docs.basekit.com#89
from simple-jekyll-search.
@christian-fei: Here you go. =)
SimpleJekyllSearch({
searchInput: document.getElementById('input'),
resultsContainer: document.getElementById('results'),
dataSource: '/search.json'
})
from simple-jekyll-search.
Ah i see, it seems you're missing the 'json' field (instead of dataSource).
I did a terrible job at versioning this time, will do better in the future.
https://github.com/christian-fei/Simple-Jekyll-Search#json-stringjson-required
Please let me know if it works, and sorry for the waste of time
from simple-jekyll-search.
@christian-fei: Oh, I didn't notice that. It works! Thanks =)
from simple-jekyll-search.
@christian-fei that'll explain why my version breaks when I update. Could this be documented somewhere for people who upgrade their version of the package?
from simple-jekyll-search.
@christian-fei would you please help to take a look my code? It just keep with the error of 'failed to get JSON'(as the the screenshot state above).
Here is my javascript code:
<script type="text/javascript">
SimpleJekyllSearch({
searchInput: document.getElementById('search'),
resultsContainer: document.getElementById('results-container'),
json: '/search.json',
searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
noResultsText: 'No results found',
limit: 10,
fuzzy: false,
exclude: ['Welcome']
})
</script>
and my css code is as following:
<div class="nav-search">
<span class="search-input"><input type="text" id="search" placeholder="Article..." /></span>
<span class="icon"><i class="fa fa-search"></i></span>
<ul id="results-container"></ul>
</div>
Thanks in advance!
from simple-jekyll-search.
@lengerfulluse: Did you add simple_search_filter.rb file to _plugins folder?
https://github.com/christian-fei/Simple-Jekyll-Search#if-search-isnt-working-due-to-invalid-json
also check in json file whether to have set up 'remove_chars'.
I think the problem is occurred for the setting of full-text search.
from simple-jekyll-search.
Wow, It did was caused by the setting of full-text search, which caused a invalid JSON.
Cool! Thanks @nakoo and @christian-fei !
from simple-jekyll-search.
Sorry guys, I just found that it only work in localhost( i run jekyll s
, and search plugin can work well on localhost:4000). Unfortunately thing is that once i put the code into online(http://t.hengwei.me), it still got the same error of failed to get /search.json. Do you have ever met the similar problems? Thanks in advance!
from simple-jekyll-search.
First of all, thanks in advance for your code!
Here the problem still remains...
JSON is well formatted, the path is in the right place, but it still got the same error:
Uncaught Error: SimpleJekyllSearch --- failed to get JSON (/search.json)
Here the way I initialize the plugin:
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: '/search.json'
});
And this is the well-formatted json... Any idea?
from simple-jekyll-search.
I was getting the same problem, @kentoo -- adding the plugin to strip characters solved it for me (it turns out I had some @
in a tag (for @import
) and it was creating invalid json
from simple-jekyll-search.
It's true! Thanks a lot.
from simple-jekyll-search.
Thanks @una !
from simple-jekyll-search.
Related Issues (20)
- Is it possible to redirect the search button to a new page? HOT 3
- Can we add custom fields to search.json? HOT 2
- Unexpected token in JSON at position 892 at JSON.parse HOT 1
- Doesn't like double quotes in code highlighter HOT 1
- SimpleJekyllSearch --- failed to get JSON (/search.json) HOT 10
- Could I trigger a search by modifying the Element value? HOT 1
- How can I know the json has been loaded HOT 4
- Callback when search results are displayed HOT 2
- switch mit license to GPL?
- Why my export zip file is 0 size?
- Search by entire phrase? HOT 3
- is't support search content. only support title HOT 6
- Code snippet breaking SimpleJekyllSearch HOT 1
- Use with GitHub Pages? HOT 3
- Highlight searched word in results
- Stating default options in README
- BUG: “Uncaught TypeError: str.trim is not a function”
- BUG: Uncaugnt TypeError: e.trim is not a function
- Missing tag for v1.10.0
- Error: SimpleJekyllSearch --- failed to get JSON (/search.json)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-jekyll-search.