JS, HTML,CSS and Python(Django) - javascript

I have a form in the html. And obviously an input box with a unique id.
THe uerenters clicks on the search input box and types the query.
Clicks on a button that is linked with javascript to provide js with whatever was entered in the input box.
But I have a python.py file which is where I want to use the term entered by the user.
How do I make the JS interact with Python? Web servers? Sockets? Whatever. Tell me steps.
Now, I have seen answers on SO and links that redirct to google app engine and so.
But If someone could provide me the step wise instructions as to how to get this done, maybe?

You can use web frameworks like Django, web2py. If you do not need a full stack framework, I recommend to you Flask.

Related

Automate stuff with Javascript

I want to automate some tasks as below:
For a particular url eg:www.xyz.com, there are list of tickets nos ..so I want to click, perform an action on it which it will result in different page..and in that page.
I need to check some already filled input boxes depending upon that..I need to add content to some other input boxes and perform submit button.
Can this type of automation be performed in js ..if yes please advise of any framework ..and if no why not and suggest any other language.
I researched quite a bit, I think it can be performed in python, but i prefer any js framework or just vanilla.
Surely you can. This can be achieved using Node.js + selenium-webdriver package to automate what you mentioned.
Here is the API document of selenium-webdriver: https://seleniumhq.github.io/selenium/docs/api/javascript/
Here you can find tutorial on how to create web automation scripts with JavaScript:
BDD Web Automation Tutorial

PDF Automation with Typeform and GoogleSpreadsheet

I need some help about the best way to do a small automation project.
I have created a form using Typeform. At the end of the form, the answers are automatically send to a Google Spreadsheet using Zapier. Now, I want to generate a PDF and send it to the user each time there is a new entry in my form. I was thinking to use Google Script (JavaScript) to do so.
The tricky part is that my form is dynamic: if the user answers A to question 1, he will jump to question 2. Else, he will directly jump to question 3 and never see question 2. So, I will have empty rows in my answer’s spreadsheet and won’t be able to just copy/paste the answers. So I am wondering: are Google Spreadsheet and Google Script the best way to generate a pdf based on answers submitted to a form? Is there another better technology to do it?
Thank you for your advices,
Romain
I suggest you have a look at autocrat. However, as your form is dynamic autocrat won't be able to dynamically build your document, if a cell is empty the field in the doc will be empty too.
It is possible to build a custom script to create a dynamic doc based on the information submitted to the sheet but that would require knowledge of the Google App Script coding.

Use an external webpage's form from my own website to get data (PHP)

I wonder if I can use an external form of a webpage in the web from my own website. I am creating an application using the WAMP tool and I need some PHP/JavaScript/whatever script to do it.
Basically I'd have the same exactly form in my website (or at least a similar one) as the one in the external webpage - the goal of this form is only to perform a search. The user would be capable of doing the search and seeing the results posted in my website aswell and all this happening in a hidden way.
I really have no idea how to do this as I searched stackoverflow and the web looking for a solution but it really seems a little bit complicated.
Here's an image to ilustrate more or less what I want:
edit: I don't want any script or code! I Just want to know what is the best way to do this. I will eventually come to a solution (I hope!). Thanks!
The concept is called Web Scraping, you can find more about it in https://en.wikipedia.org/wiki/Web_scraping
As an answer, you can write simple web scraper using PHP CURL.
CURL can submit a remote form for you and get the results of form submit, that results may need to be handled by your script to be displayed in the form you need.
This stackoverflow question and answer may clear it more for you.
How to submit form on an external website and get generated HTML?

Changing site language with only javascript without server site code

My website only have 5 html page. I want to change language with javascript or jquery. How can i do that. I want to change language with one click but other page will still same language. What i must supposed to do?
Looks like Google has a free service for this
https://translate.google.com/manager/website/
You have very few options.
Have html version of your page in every language you have on your
website with corresponding links and maybe cookies to keep track of
your language.
Have all text in Javascript files and keep track of language in cookies and update text with JavaScript accordingly

How can i change the language of my Html5 hybrid application using java script and jQuery?

In my application i have a option of language selection.
When I select an option, the entire application language should be changed.
I have already tried using Google and Microsoft api but guess that is paid. Is there any free api using javascript that can help me regarding this problem.
This post might be what you are looking for. They are talking about:
A wordpress, change language plugin widget.
A jQuery handler to change language by directing to another url.
Have a nice day!
Two options:
#1
Have a look here. Click "Options" top right and select another langauges. Open a datebox plugin widget and it will be in the language you specified.
I like the way it's done using Crowdin, although you will end up with all your text in .js files. If you check out one of the languages sample files this will be a lot of meat to load if your site becomes more complex.
#2
Do this server side. I'm (using Coldfusion) loading a langauge object on first page load and cache this until the user selects a new language. My langauge object is about 60k with 2000 entries. You could also send this to the page from server via json and store it in the page, then you could reference it from Jquery/Javascript.
I will probably end up trying to switch from server side to using the first approach and will try to see if I can split up my language .js files according to JQM page and then load them together with require, which would mean only a few ks per page. If you don't mind having a bunch of langauge files for each language and page, this would probably be the best "Mobile" approach.

Categories