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?

WeGi
  • 1,908
  • 1
  • 21
  • 33
  • JavaScript - Client-side Scripting – Nick Apr 07 '14 at 21:57
  • 1
    Use `jQuery` to send the data you want to the server and then have the PHP do the DB stuff – zero298 Apr 07 '14 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)? – jfriend00 Apr 07 '14 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. – WeGi Apr 07 '14 at 22:05

1 Answers1

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/

Patrick Eaton
  • 706
  • 3
  • 11