Home Baked Google Instant (Just the fancy AJAX) - javascript

Anyone know how you could duplicate the instant nature of Google Instant?
I'm trying to create a similar functionality with hand carved results (basically a huge if statement) on a website.
Some more clarification:
If a user were to type 'phone' in a search bar, contact information would instantly appear below.
more clarification:
I don't really want predictive results, just simply returning results based on keyword instantly below the input bar.

So you want to move the search box on the first keystroke in a box then use ajax to retrieve results? Sounds like the bulk of what you're asking to do...
Business statements -> code

Try this post http://www.rsc-ne-scotland.org.uk/mashe/2010/09/google-custom-instant/ It's a very simple implementation using jquery and Google custom search returning JSON.

Related

Calling a website with results from javascript

I have a small app which calls an URL and scrape the data returned from it. I now want to do something similar for another site but this site uses JavaScript and the results are not included in the html. I've found a way to retrieve the data by using "stringByEvaluatingJavaScript" but to complicate things, the results I want is displayed on the webpage only after I click a button / function on the website:
i.e. To get to display the results I want, I have to:
1) go to the website. (data is displayed but not what I want) 2) click one of the options on the site. (data I really want is displayed)
The URL of this page never changes, as expected being JavaScript. So I want to know if there's a way to call the page so that when the page is displayed, it is already on the option I want, e.g. "https://example.com/page1?option" etc...
I don't know if this is possible since I don't know JavaScript but technically I think it should be?
Thanks.
I would use the Developer Tools/javascript console on your browser
(Chrome has a pretty good one) to see what the browser sends to the
server when you click on the button, then use that as the basis for
your query. – cowbert
#cowbert's suggestion really did the trick! Upon digging more, I found more results in the Chrome console and one of them actually has the link to the data which is what I need!
Thank you to all who contributed! This is my first post here so if I didn't do something right, please forgive me.

How to update table value from Google search result

So I was challenged to make a table that its value is based on search result from Google. I was tasked with three things that's totally new for me:
For example, I have the name of Barrack Obama and Abraham Lincoln, when I click on Barrack Obama, the table (with three columns: Number, Page Title, and URL) will be updated according to the Google search result of "Barrack Obama" and when Abraham Lincoln is clicked, the table will be updated again accordingly.
I was asked to make the table changeable, must able to swap columns, resize, order it by ascending or descending.
and finally, when I click on the URL or any of the list, the result page could appear on the same page (on a reading panel, a different section from the table but still on the same page, let's say it's on the right side section of a webpage), and should be resize-able as well
Can somebody give me a pointer or clue on where should I start looking or doing? I was only given clue as using JSON, Jquery, or Google API, but I don't quite sure of the specifics. Any help is appreciated, sorry for the multiple question, I had to since it was related in some way (I think). Thank you for the response!
Google does not have an API for their search results, but here's the general flow of logic:
You will need to make a GET AJAX request using XMLHttpRequest or jQuery on a Google search URL. Do some playing around with Google searches and you can see how they format them:
https://www.google.com/?#q=barack+obama
On the returned HTML page, you should parse out the results and set your table data. Again, play with the Google search results page and see how it's formatting.
For #3, the returned HTML object can be embedded in something like an iframe to give the user a reading panel.
For resizing, there aren't any default HTML tags that will resize like a split pane. If you decide to go with jQuery, you could look at the jQuery UI or other widgets that give you the resizing functionality you'd like.

Loading and running an external webpage

I have been asking this question in different places but couldn't get a real answer.
Here is the problem:
Let say I have a web page which is going to serve like google. I mean it will use google at the bacground but foreground will be my page. It will contain a textbox and a button. So a user will come and enter a text that he wants to search and click the button to submit the query. So my webpage will transfer this search text to the google at the background and search the thing in google. It will return the results to my webpage in a different form. `
So the question is, what is the best way of implementing this and more importantly is it possible.
Many thanks.
You will have to use Google Custom Search API: https://developers.google.com/custom-search/v1/overview
You cannot use classic web crawler techniques to get the data from Google since that violates their TOS.

Applying Choices in Fields using View in Lotus Domino Web application

I can't quite figure out a work around for using "Use view dialog for choices" in a web based application.
My Question is how can i convert this settings in my field in the Control Tab then Choices, in choices "Use view dialog for choices" then Use current database and access view and a specific column.
Thanks in advance :)
"Use view dialog for choices" is almost always a way to get around the restrictions on the return value of a formula. For instance, you'd use it when #DbColumn in a choices formula for a listbox or dialog list choices formula would cause an error.
The upshot of that is that there's no "one-shot" workaround for the web. A direct functional replacement would be to open the view in a pop-up window or overlay div, and attach some JavaScript to the view in order to override the default web behaviour and force the return of values to a field on the main document. This approach will work well, but it may require server settings that allow the entire view to be served at once (the maximum lines to display per page will probably be less than you need), and it's subject to breakage if the HTML used to display the view ever changes.
You can use LotusScript or Java in a WebQueryOpen agent to populate a conventional widget (the list of a element) in a Rich Text field, either using PassThru HTML or a "Treat contents as HTML" form. That would involve getting the view, then doing a document-by-document (or category-by-category) run through the view index to get the column values you need. (If you take this approach, use the ColumnValues rather than the document field name to retrieve the values -- the cost of opening the document to read the values is high, and your code will take many times longer to run.)
You can also get the view as need using an AJAX request and a ?ReadViewEntries query, which will return an XML representation of the view. Again, you may have to have the maximum view lines per page limit upped in order to get the amount of data you need. You can get around that, though, by using a "suggest" method that doesn't begin retrieving data until the user enters at least one character into the field.
All of these approaches mean using a separate form for the web. That's easy enough -- you simply create a form with the same alias (or name, if you're not using aliases) as the one you're using for the Notes client. In the list of forms in Designer, you can use the hidewhen tab to hide one from the Notes client and the other from the web. (Note that you can create an additional form for mobile devices the same way if necessary.)
I can't get more specific than this with the information at hand. If this is insufficient to point you in the right direction, then edit your question to be more specific (and post a comment to this reply -- I don't spend a lot of time on SO, but I do spend time on other StackExchange sites, so I'll be notified).
Unfortunately, you have to develop it yourself.
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=AJAX%20Name%20Picker
AJAX-based name picker is a good start I guess.

jQuery UI autocomplete "no match" select

I've read through nearly all the posts on jQuery UI autocomplete, but I still can't figure this out.
If there isn't a match, I need to append an item to the list that says something like:
Create an entry for "Search Term Being Entered"
so it can be selected and I can run a function to deal with a new entry.
The problem I'm having is figuring out which event I need to hook into to update the menu and list.
This question may point you in the right direction:
Detecting no results on jQuery UI autocomplete
Be sure to look at the fiddle in Andrew's answer:
http://jsfiddle.net/andrewwhitaker/VBTGJ/
Wouldn't the server normally decide if the user entered a 'new item'?
I'm just making some basic assumptions here about your environment. The auto-complete list comes from some MySQL data. So the server should know if a term is new. Never trust user input from the client.
An autocomplete UI is not a way to force a certain input, it's merely a tool for the user to reuse existing or common values. The actual interpretation should happen on the server.

Categories

Resources