Website building, ask server to run a script with input [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 5 years ago.
Improve this question
I'm quite a newbie in everything related to web development, but I had this project in my mind that I really wanted to realize.
At the moment I am struggling with a method to send a request to the server hosting the website. The idea is that from the site you can enter keywords, and those keywords should be run in a script (python or java(script)) on the server after which it returns an output to the webpage. In theory this script could be executed in the website itself as javascript, but I would like to use the computing power and internet access from the server.
I have researched on using Json and javascript for the job, but I think there has to be a better way for this purpose. Is there anyone that can direct me where to look?

You should build your form in HTML. (More info: https://www.w3schools.com/html/html_forms.asp)
In client-side JavaScript (the code that website users have executing in their browser), you should use the jQuery library to scoop the data out of your form. Take a look at the .submit() and .val() functions to get started. Then you can use jQuery's AJAX function to submit requests to the server-side API in a JSON format.
On the server, in addition to creating a way of serving up the webpages (with their client-side JavaScript), you will then need to create an API to receive and respond to these requests. One way to do this is by running Node.js with Express, which will allow you to write your API in JavaScript. The downside to this is you will have to pay to get a full-fledged virtualized cloud server through AWS, Rackspace, or another host. The other option is for you to write your API in PHP, which is supported by free webhosts like x10hosting.com.

Related

How can I run a python script from javascript? [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 5 years ago.
Improve this question
im working on a project where i have to create a gui for. The page that i'm working on has a form for user input that asks for a string. i want to take that input and send it to a python script that I have created for processing. The python script will then return a string of words to the javascript so that i can display it to the user in the webpage. Is there any way I can do so?
note: i am not an expert in programming hence please cut me some slack. it would be great if i could get a few examples as well.
You probably want to create and expose an HTTP endpoint using a Python web framework; the easiest choice would be Flask
This would require you to create a route/action view to handle POST requests using the Python script you created. You can then consume that HTTP endpoint using AJAX.
Another option would be to leverage the "serverless" infrastructure that Amazon Web Services provides; that way you could create an HTTP endpoint using Amazon API Gateway, and have that endpoint call an Amazon Lambda Python function, which would run your Python script and return the results. The advantage of this method is that is incredibly cheap and relatively easy to set up, especially if you only need to call that one Python script. Also, with this set up you wouldn't have to spin or maintain any web server yourself, since your Python script would be running directly on Amazon's servers.
Best of luck.

Does Javascript and Jquery languages are enough to make a working web messenger application? [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 6 years ago.
Improve this question
Can we make a web based messenger application through the use of just these two languages javascript and jquery?
You will at least need to learn some basics of HTML as well.
(Hopefully) you also want to style your application, which means you should learn at least some CSS.
As far as programming languages go you will however need to know JavaScript and can use jQuery (among other things) to manipulate DOM.
Many modern applications however user React or Angular heavily to make the application building process easier in the long run.
You will also need to store your data somewhere, which means either server-side code and learning how to use a database such as mySQL, MongoDB or CouchDB to name a few (noSQL such as MongoDB or CouchDB are probably more appropriate for a messaging app). Or make it easier on yourself and use Firebase or something similar to store and retrieve data as well as handle user account and authentication.
I know all this may seem overwhelming, but making web apps involves a lot of moving parts.
SUMMARY
If you are starting out, I would recommend simpler challenges than a web app, but if that is what you are set on, the easiest in my opinion would be:
HTML + CSS + JQUERY (this is how your app UI is handled)
JAVASCRIPT (connects UI and data)
FIREBASE (stores data and enables user management and authentification)
Resources to help you get started:
https://www.codecademy.com
https://firebase.google.com

create PDF file in JS [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 8 years ago.
Improve this question
I am developing a web application using client side MVC. The technology stack is Backbone JS, HTML5 and Spring at the Server side.
I have a requirement where I do some data manipulation at the client side using Javascript by using JSON files as the data payload kept on the web server directly. This is a high traffic part of the app and I don't want to hit my app server for such siple data manipulations.
Now on the same module - I have a requirement where I need to generate a PDF file which effectively contains a static template and then I need to fill the template using effectively the same data that I already have at client side. I need to generate the PDF and let the user download it.
Any idea how can I acheive it completely at the client side in a clean and robust way.
From what I understand is you have an html template that you want to fill with certain data and then render it as a pdf?
For client side, have tried looking at something like jsPdf (http://parall.ax/products/jspdf)? The html renderer is still in early stages but it seems to work decently.
As Bogdan pointed out, a backend solution is also possible. You could look at pd4ml (http://pd4ml.com/) or even call into something like pandoc (http://johnmacfarlane.net/pandoc/) or even phantomjs (http://phantomjs.org/) to perform the conversion and then pass the generated pdf back to the client.
If it is not an html template, I am sure a number of the above solution should work regardless.

Build website using JSP or Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have to build a website which involve e-commerce stuff like it should allow the users to login and then view the available items. Once the user selects the items and makes payment, it may need additional information in the form of some images/videos to complete the order. So, after payment step, it prompts the user to upload the file and when the file is uploaded on the server, request is complete and the user is kept informed about the status.
All the core functionality is already implemented using REST-ful webservices. I am not able to decide if I should implement the website using HTML+JS (using AJAX to call webservices) or should still use JSP and call webservices using java at server side? Someone suggested me that using JSP is better since it will execute on server side and hence will be secured and faster. But, I somehow feel that HTML+JS is easier to go. Is there some specific advantage to use a server side script like JSP for this purpose? Any ideas are most welcome.
Yes server side scripting will be fruitful for this purpose for security constraints. Or you can use angular js though they are easy to learn and they are secure and can make fast XHR request response. :)

Quickest way to implement a basic REST/SOAP server and client for a beginner? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I would really appreciate some help and also I apologize if this is the incorrect type of question for this site.
Basically, as part of my University coursework I have been tasked with creating a REST/SOAP server and client that allows users to store playlist/song information and update it etc.
My problem however is that all the tutorials provided by the university are for Visual Basic, a program and language that I have yet to learn. Additionally the tutorials seem to consist of "open a new project, copy and paste this code, now run it".
I am aware that REST/SOAP can be implemented in a variety of ways and so I would like to find out what the easiest way for me to learn would be.
I am comfortable with javascript/jquery so any solutions involving those would be preferable. I also wouldn't mind using the opportunity to learn Python if it's feasible.
PHP is great, it has a built in SoapClient and is huge in industry as a SOAP/RESTful API language. Anything non-Microsoft will usually use PHP.
As for the client, javascript can very easily work with SOAP objects, as an alternative to SOAP see JSON as a more lightweight communication protocol.
As a starting point, install WAMP if you are on windows, or LAMP on linux and I think MAMP for mac. This sets up a server on your local machine.
Write some php code and run it from your browser to see it spit out raw data. From there you should be able to start learning php basics. http://php.net will have some tutorials.
Regarding the client, check this out it is about jquery processing SOAP responses. Is it possible to parse a SOAP response with a jQuery xml handler?

Categories

Resources