Is it possible to add a JavaScript variable in an SQL Server database database (run an SQL query or stored procedure)? If so, how?
With JavaScript only, no you cannot (unless you're using Node.js of course).
The point is, you'll need some server-side code to interact with your database. You can use JavaScript in the browser to make an Ajax call to a server-side script (PHP, Ruby, Python, ASP.NET, Node.js, etc.) that performs the interaction with the database.
You can not access the database from JavaScript. You need to send your data to PHP, Ruby on Rails or ASP.NET or whatever you are using to implement the back end.
You can use Ajax to post to a web service of some sort (or any other server side script) to pass the JavaScript value. The web service would access the database and save it...
Set value of variable in the hidden field and get value of that field at server side when submit form and save it into the database....
You can easily access a database from JavaScript in Node.js.
If you're doing it from the browser, you'll most definitely need some kind of mid-tier service which translates HTTP queries to the relevant database driver (you can write that in any language you want - PHP, JavaScript, ASP.NET, etc.).
Related
I'm trying to store value in client side and access it in server side without using hidden field because of security issues.
I tried using label but I wasn't able to access the value on server side.
I could use web methods but I don't want to postback the page and I cannot use viewstate because its is encrypted and using session is not a good option.
Try doing this, it can be posted to any server side languages such as asp, php or aspx pages.
http://www.w3schools.com/jquery/ajax_post.asp
Jquery Ajax - post huge string value
Thanks,
Anand
I know how to make the layout but I want to know how to make a login system that saves a username and password without PHP, with Javascript or JQuery.
Ultimately, you cannot enforce the security of code running inside the user's web browser in a way that would be necessary for a meaningful login system. The processing model of the web requires you to process some form of input submitted by the client (e.g. a username and password) against some private logic or data on the server (e.g. a one-way hash of the password in a database). It is also server-side code which needs to know that a user is logged in, and what permissions that grants them.
If you like JS as a language, you could look into node.js, which runs JS as the server-side platform rather than some other language like PHP or Ruby.
The only other alternative, I think, is the extremely limited "HTTP Basic Auth", which lets you forbid access to certain URLs based on a manually maintained list of passwords.
With HTML and Javascript everything is done on the client side. Without have some type of server side system, anything can be trapped on the client side.
Google offers some ways to use libraries and their servers to build stable login solutions.
https://developers.google.com/+/quickstart/javascript
if you want to store data at server side, then No, you can not do using client script.
But if you want to store it locally, then you can use HTML5 Local Storage.
Also refer javascript-save-local-data
Actually I am developing a web portal for this purpose I need to use the Database API of different servers to access the details of database. I am using JAVA SCRIPT as frontend language and MYSQL as the backend. Please give an example How can I use APIs for this purpose
Thank u in advance
You cannot. Javascript only has APIs for a limited set of storage frameworks. MySQL is not one of them. You would need some server side language.
JavaScript is client side scripting language. You can't call database using JavaScript. Use any server side programming like Node JS, PHP, Java etc.
I am looking for a way to save simple form data from a static web page without any server-side code. I've considered something like MongoLab via RESTful interface, but that would require including API credentials client-side and the saved data must be private. Any suggestions? Thanks.
you need to post you form data somewhere, so you must have a server listening for a http form submit, or alternatively use something like socket.io / WebSockets to send all the data to a server. You cannot write to a database from a user browser without contacting some server that will write the information to the database..
Hadn't thought of using a BaaS (back-end-as-a-service) provider like parse or stackmob, but that's the solution. Just hadn't thought of using it for a simple, static web page. I signed up for parse.com and was collecting data within five minutes!
I was wondering if it is possible to write to a server and storing it in a text file using Javascript/Jquery, HTML5. The purpose is, I am making a javascript/jquery game and I wanted to store the scores, without using any server-side language (php, asp, etc.)
Thank you so much for the help, your time is much appreciated.
HTML, JS, CSS, all that is client-side. Meaning it runs in the browser and that's that.
PHP & ASP are server-side, meaning the code gets executed on the server and the result gets sent to the client.
You need a method of communication between the client and server. You can send requests using JS (AJAX) but you'll need something on the server to receive and do something with them. For that you need some server-side code.
So no, you can't update data on a server using only client-side technologies. You can, however, use client-side scripts to communicate with a server and tell the server-side code to update data.