How can I save data (searches) in session/localmachine, I mean, save anywhere less DB, all form fields for future use everytime that form is submited?
(…)
$('#button_submit').click(function() {
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();
var type = $('#type').val();
var tempArr = new Array();
var json = window.sessionStorage['search'];
if(json)
tempArr = JSON.parse(json);
tempArr.push(JSON.parse('{"start_date" : "'+start_date+'" , "end_date" : "'+end_date+'" , "type" : "'+type+'"}'));
window.sessionStorage['search'] = JSON.stringify(tempArr);
drawChart(start_date, end_date, type)
});
(…)
This code dont solve my problem.
I need to save start_date, end_date and type values everytime form is submited and create some buttons/links for that old searches to be able to see old results.
The point is grab those values and stick them in this drawChart(start_date, end_date, type). This is the function that will produce my results.
with my code i got this [{"start_date":"2012-02-05","end_date":"2012-12-26","type":"pie"}] this is tempArray[0]. But what I need is grab this start_date, end_date and type separated values , not like it is atm
For this problem, the use of suitable object localSorage, though it is not supported by all browsers. Supported browsers: http://www.w3schools.com/html/html5_webstorage.asp
Example