0

i am quite new to jQuery and i cant seem to find a method to write to a database on the server on which jquery is running. Is there a sqlite plugin or similar?

I want to be able to let the user make some input, which gets processed and stored in a database. Is it possible in javascript/jQuery at all, or do I have to turn to PHP?

4
  • JavaScript - Client-side Scripting Commented Apr 7, 2014 at 21:57
  • 1
    Use jQuery to send the data you want to the server and then have the PHP do the DB stuff Commented Apr 7, 2014 at 21:57
  • Is this a client side question (Javascript running in a browser and you want to write to the database from the browser) or is this a server-side question (Javascript running on a server - perhaps node.js and you want to write to the database from a server process)? Commented Apr 7, 2014 at 22:01
  • It is client-side javascript. And it doesnt have to be writen directly from the javascript, i would be happy to use python, but i don't know how to send request from the jquery application to serverside python. Commented Apr 7, 2014 at 22:05

1 Answer 1

2

jQuery is entirely client side, you're going to need to use PHP or another language to actually interact with the database and just use jQuery to send the information via the AJAX method.

$.ajax({
  type: "POST",
  url: "some.php",
  data: { name: "John", location: "Boston" }
})
  .done(function( msg ) {
    alert( "Data Saved: " + msg );
});

Taken from

https://api.jquery.com/jQuery.ajax/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.