How can a user query my mongodb with a search bar? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
What should I do to enable users of my website to type in something to a search bar and have it query my mongodb? I am using meteor JS so perhaps that will help with an answer. Thanks.

There are a few good meteor packages out there depending on what kind of functionality you need. I would suggest checking out meteorhacks:search-source, which will implement instant search for you, and does most of the work behind the scenes.
Check out https://meteorhacks.com/implementing-an-instant-search-solution-with-meteor.html for a good intro tutorial.

You could add a 'change' event handler on your <input> element and fire off a jQuery $.post request. Consider this:
$('#input-box').change(function() {
var postData = $(this).val();
$.post('/your/url', postData, function(dataFromMongoDB) {
// Query MongoDB on the server and return the data
console.log(dataFromMongoDB);
});
});

Related

Real time website information/content updating [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Since a year and a half I am trying to figure out how some websites update their content in real time without AJAX method.
Please see this example website: https://pro.btcturk.com/en/basic/exchange/BTC_TRY
That website is changing many texts within content in different timing.
It means that when the server is updated with new values in the database then the website is listening to database changes and then reflecting/delivering inside content without ajax calls.
Can someone give an example how to achieve such functionality possibly using Javascript or PHP normal hand-code appreciated?
Thank you
You can see the process here:
More information here: Websockets

Way to display information when clicking an object [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Is there a way to make an object submit button?
By clicking an object such as image, I want to submit.
Can anyone give me an clue?
You can use jQuery, it's very simple:
// Listen for a click on an element
$('#objectId').click(function() {
// Do something, like submit a form
$('#formId').submit();
});
you can use ajax to show information from database. For simple using ajax - download jquery or axios.
Example:
jquery ajax documentation
axios documentation

Default path of database in a bootstrap website? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
My Boss just gave me a website of his friend so the developer that build it was fired and i need to access the data base to change things.
The Website is developed using Bootstrap and I never used it Before where do I find the definition of the database connection help please.
Nowhere.
Bootstrap is a collection of CSS and (client-side) JavaScript.
It isn't a traditional, server-side MVC framework (or anything else that would fulfil a similar role) and doesn't do anything that would involve a database.
Bootstrap might be used in the output of a View from such a framework, but that's handled at a different level in the codebase.

How to use grid in HTML [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a assignment.
I want to create a grid with list of friends with their name and photo add search bar on top of it whenever you type their name, it should filter and show only that by default it should show all.
This can be easy achieved using JQuery and a 3rd party javascript library called "Datatables".
Basically you only need to create an HTML table with all the names and photos, then add JQuery and Datatbles libraries to your HTML and initialize it.
On this link:
https://www.datatables.net/examples/basic_init/zero_configuration.html
you will find the most basic code example to configure datatables.
As comment, this solution will indeed give you the results you look for, but if this is a homework maybe your professor is expecting to you to code this functionality from scratch and not using 3rd party libraries.
Regards.

Get value from another site (yahoo)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
there is a wayto get the value from yahoo site in this url "http://finance.yahoo.com/q?s=mo&ql=1". i need only the value of "Next Earnings Date".
how to do that in ajax?
Since Cross-Domain-Requests are not allowed in Browsers, you can't do it with pure JavaScript. You can either use php with curl to fetch the page and parse it, or use a helper API.
I would recommend having a look at YQL (Yahoo Query Language). With this API you can fetch any page.
https://developer.yahoo.com/yql/console/
A jQuery plugin that makes use of this API is: https://github.com/padolsey-archive/jquery.fn/tree/master/cross-domain-ajax

Categories