Reputation: 2367
I have a script that extracts the p elements in a document using jQuery. With jQuery I map these to a normal array. I was just looking for some insight on how to store this in a database through jQuery.
EDIT: I use jQuery to scrape the p elements on a set of pages
var textnode = $(source).children("p:not(:has(img))").map(function() {
return $(this).outerHTML();
}).get();
I was wondering how I would get started on storing this array into a database
Upvotes: 0
Views: 106
Reputation: 70055
Typically, jQuery does not talk directly to a database. The main issue is that jQuery usually runs on the client side and databases for web applications are typically (although, of course, not always) on the server side.
In a few cases, storing the information client-side via HTML5 or something else might be an option. In most cases, that will result in problems around varying levels of HTML5 support in different versions of different browser and/or might be inappropriate for other reasons (such as perhaps multiple clients need to be able to read the same data back).
In some cases, it may be OK to send the data to a server (via any number of ways: .ajax()
is one) that can store it in a database. In many cases, there will be issues around security/encryption/privacy with this approach.
Upvotes: 1